Boost.Real  1.0.0
Boost.Real numerical data type for real numbers representation using range arithmetic.
boundary_helper.hpp
1 #ifndef BOOST_REAL_BOUNDARY_HELPER_HPP
2 #define BOOST_REAL_BOUNDARY_HELPER_HPP
3 
4 #include <algorithm>
5 #include "interval.hpp"
6 
7 namespace boost {
8  namespace real {
9  namespace helper {
10 
25  bool aligned_vectors_is_lower(const std::vector<int> &lhs, const std::vector<int> &rhs) {
26 
27  // Check if lhs is lower than rhs
28  auto lhs_it = lhs.cbegin();
29  auto rhs_it = rhs.cbegin();
30  while (rhs_it != rhs.end() && lhs_it != lhs.end() && *lhs_it == *rhs_it) {
31  ++lhs_it;
32  ++rhs_it;
33  }
34 
35  if (rhs_it != rhs.cend() && lhs_it != lhs.cend()) {
36  return *lhs_it < *rhs_it;
37  }
38 
39  bool lhs_all_zero = std::all_of(lhs_it, lhs.cend(), [](int i){ return i == 0; });
40  bool rhs_all_zero = std::all_of(rhs_it, rhs.cend(), [](int i){ return i == 0; });
41 
42  return lhs_all_zero && !rhs_all_zero;
43  }
44 
45  }
46  }
47 }
48 
49 #endif //BOOST_REAL_BOUNDARY_HELPER_HPP
Definition: boundary.hpp:7