6 #include <boost/range/algorithm/set_algorithm.hpp>
7 #include <boost/range/iterator_range_core.hpp>
14 template <
typename Range,
typename Predicate>
25 template <
typename Container>
26 typename Container::value_type
27 back(
const Container& container)
31 auto i = begin(container);
32 auto iend = end(container);
35 for (++i; i != iend; ++i)
40 template <
typename Container,
typename Predicate>
41 void erase_if(Container& c,
const Predicate& p)
45 for (
auto i = begin(c); i != end(c); )
56 template <
typename Container>
57 typename Container::value_type
58 front(
const Container& container)
62 auto i = begin(container);
63 assert(i != end(container));
69 template <
typename Iterator,
typename Pred,
typename Less>
70 boost::iterator_range<Iterator>
75 for (
auto i = begin;; ++i)
77 auto next = std::next(i);
91 template <
typename Container,
typename Compare>
94 auto i = std::begin(container);
95 auto end = std::end(container);
99 for (++i; i != end; ++i)
110 template <
typename Container>
111 typename Container::value_type
114 auto i = std::begin(container);
115 auto end = std::end(container);
120 for (++i; i != end; ++i)
129 template <
typename Range,
typename Predicate>
138 template <
typename Range,
typename Value>
141 return none_of(r, [&value](
const Value&
v) {
return v == value; });
146 template <
typename Container,
148 typename =
typename Container::value_type>
152 auto res = Container{s1.key_comp(), s1.get_allocator()};
153 auto i = std::insert_iterator<Container>{res, res.begin()};
159 template <
typename Container,
161 typename =
typename Container::value_type>
165 auto res = Container{s1.key_comp(), s1.get_allocator()};
166 auto i = std::insert_iterator<Container>{res, res.begin()};
172 template <
typename Container>
176 if (x.size() == y.size())
178 using std::begin;
using std::end;
179 for (
auto xi = begin(x), xend = end(x), yi = begin(y);
182 if (x.key_comp()(xi->first, yi->first)
183 || x.key_comp()(yi->first, xi->first))
192 template <
typename Container,
194 typename =
typename Container::value_type>
198 auto res = Container{s1.key_comp(), s1.get_allocator()};
199 auto i = std::insert_iterator<Container>{res, res.begin()};
boost::iterator_range< Iterator > initial_sorted_range(Iterator begin, Iterator end, Pred pred, Less less)
The return the longest initial range of elements matching the predicate.
Container::value_type back(const Container &container)
The last member of this Container.
bool any_of(const Range &r, Predicate p)
bool is_sorted_forward(const Container &container, Compare comp)
Same as std::is_sorted, but works with an input iterator, not just a forward iterator.
bool same_domain(const Container &x, const Container &y)
Check that two associative containers have the same keys.
Container::value_type max_forward(const Container &container)
Same as *std::max_element, but works with an input iterator, not just a forward iterator.
Provide a variadic mul on top of a binary mul(), and one().
bool none_of(const Range &r, Predicate p)
void erase_if(Container &c, const Predicate &p)
Container set_union(const Container &s1, const Container &s2)
The union of two sets.
bool none_of_equal(const Range &r, const Value &value)
Container set_intersection(const Container &s1, const Container &s2)
The intersection of two sets.
Container::value_type front(const Container &container)
The first member of this Container.
Container set_difference(const Container &s1, const Container &s2)
The set of members of s1 that are not members of s2.
Functor to compare Values of ValueSets.