inline bool is_mergeable (const range<iter1_t> &src1, const range<iter2_t> &src2, compare comp ) { //---------------------------- begin ------------------------------------ typedef typename iterator_traits<iter1_t>::value_type type1 ; typedef typename iterator_traits<iter2_t>::value_type type2 ; static_assert ( std::is_same<type1, type2>::value, "Incompatible iterators\n"); //---------------------------- begin -------------------------------------- return comp ( *(src2.front()), *(src1.back())); };
inline range<entity<Segments ... >> join(range<entity<Segments ... >> const & one, range<entity<Segments ... >> const & two) noexcept { return { std::min(one.offset(), two.offset()), (std::max(one.back(), two.back()) + 1) - std::min(one.offset(), two.offset()) }; }
inline type::bool_t intersects(range<entity<Segments ... >> const & one, range<entity<Segments ... >> const & two) noexcept { return (one.front() <= two.back()) && (two.front() <= one.back()); }
inline range<entity<Segments ... >> take_last(range<entity<Segments ... >> const & object, type::index_t const count) noexcept { return { object.back() - ((count % (object.length() + 1)) - 1), count % (object.length() + 1) }; }