7 #include <boost/range/algorithm/set_algorithm.hpp>
8 #include <boost/range/iterator_range_core.hpp>
15 template <
typename Range,
typename Predicate>
23 template <
typename Range>
29 [](
const auto& p) ->
bool {
return p; });
35 template <
typename Container>
36 typename Container::value_type
37 back(
const Container& container)
41 auto i = begin(container);
42 auto iend = end(container);
45 for (++i; i != iend; ++i)
50 template <
typename Container,
typename Predicate>
51 void erase_if(Container& c,
const Predicate& p)
55 for (
auto i = begin(c); i != end(c); )
66 template <
typename Container>
67 typename Container::value_type
68 front(
const Container& container)
72 auto i = begin(container);
73 assert(i != end(container));
78 template <
typename Iterator,
typename Pred,
typename Less>
79 boost::iterator_range<Iterator>
84 for (
auto i = begin;; ++i)
86 auto next = std::next(i);
100 template <
typename Container,
typename Compare>
103 auto i = std::begin(container);
104 auto end = std::end(container);
108 for (++i; i != end; ++i)
119 template <
typename Container>
120 typename Container::value_type
123 auto i = std::begin(container);
124 auto end = std::end(container);
129 for (++i; i != end; ++i)
138 template <
typename Range,
typename Predicate>
147 template <
typename Range,
typename Value>
150 return none_of(r, [&value](
const Value&
v) {
return v == value; });
156 template <
typename Container,
typename Fun>
159 using value_t = decltype(std::forward<Fun>(fun)(*begin(c)));
160 auto res = std::vector<value_t>(c.size());
167 template <
typename Container,
169 typename =
typename Container::value_type>
173 auto res = Container{s1.key_comp(), s1.get_allocator()};
174 auto i = std::insert_iterator<Container>{
res,
res.begin()};
180 template <
typename Container,
182 typename =
typename Container::value_type>
186 auto res = Container{s1.key_comp(), s1.get_allocator()};
187 auto i = std::insert_iterator<Container>{
res,
res.begin()};
193 template <
typename Container>
197 if (x.size() == y.size())
199 using std::begin;
using std::end;
200 for (
auto xi = begin(x), xend = end(x), yi = begin(y);
203 if (x.key_comp()(xi->first, yi->first)
204 || x.key_comp()(yi->first, xi->first))
213 template <
typename Container,
215 typename =
typename Container::value_type>
219 auto res = Container{s1.key_comp(), s1.get_allocator()};
220 auto i = std::insert_iterator<Container>{
res,
res.begin()};
Container::value_type front(const Container &container)
The first member of this Container.
void erase_if(Container &c, const Predicate &p)
bool any_of(const Range &r, Predicate p)
Functor to compare Values of ValueSets.
Container set_intersection(const Container &s1, const Container &s2)
The intersection of two sets.
bool any_of(const Range &r)
Container set_union(const Container &s1, const Container &s2)
The union of two sets.
Provide a variadic mul on top of a binary mul(), and one().
Container set_difference(const Container &s1, const Container &s2)
The set of members of s1 that are not members of s2.
auto transform(const Container &c, Fun &&fun)
Map a unary function on a container of values, and return the vector the results. ...
boost::iterator_range< Iterator > initial_sorted_range(Iterator begin, Iterator end, Pred pred, Less less)
The longest initial range of elements matching the predicate.
bool none_of(const Range &r, Predicate p)
bool same_domain(const Container &x, const Container &y)
Check that two associative containers have the same keys.
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.
Container::value_type back(const Container &container)
The last member of this Container.
bool none_of_equal(const Range &r, const Value &value)
Container::value_type max_forward(const Container &container)
Same as *std::max_element, but works with an input iterator, not just a forward iterator.