45template<
class InputIt1,
class InputIt2,
class Compare>
46bool excludes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) {
47 while (first2 != last2 && first1 != last1) {
48 if (comp(*first2, *first1)) {
50 }
else if (comp(*first1, *first2)) {
77template<
class InputIt1,
class InputIt2>
78bool excludes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) {
79 return excludes(first1, last1, first2, last2, std::less<
decltype(*first1)>());
92template <
class InputIterator1,
class InputIterator2,
class OutputIterator1,
class OutputIterator2,
class Compare >
93void set_symmetric_difference ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator1 result1, OutputIterator2 result2, Compare comp ) {
94 while ( first1 != last1 && first2 != last2 ) {
95 if ( comp ( * first1, * first2 ) ) {
99 }
else if ( comp ( * first2, * first1 ) ) {
100 * result2 = * first2;
109 if ( first1 == last1 ) {
110 std::copy ( first2, last2, result2 );
112 if ( first2 == last2 ) {
113 std::copy ( first1, last1, result1 );
127template <
class InputIterator1,
class InputIterator2,
class OutputIterator1,
class OutputIterator2 >
128void set_symmetric_difference ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator1 result1, OutputIterator2 result2 ) {
129 set_symmetric_difference ( first1, last1, first2, last2, result1, result2, std::less <
decltype ( * first1 ) > ( ) );
149template <
class ResType,
class InType,
typename ... Ts,
template <
typename ... >
class ContainerType, class Callback >
150ContainerType < ResType >
transform(const ContainerType < InType, Ts ... > & in, Callback
transform ) {
151 ContainerType<ResType>
res;
169template<
class InputIt,
class Element>
170bool contains(InputIt first, InputIt last,
const Element& elem) {
171 return find(first, last, elem) != last;
187template<
class InputIt,
class Element>
189 return binary_search(first, last, elem) != last;
208template <
class Iterator,
class Value >
215 Iterator openPos =
begin;
219 if ( subRange.first == subRange.second )
221 begin = subRange.second;
234 Iterator closePos =
begin;
255template <
class Iterator,
class Value >
256std::pair < Iterator, Iterator >
find_range ( Iterator
begin, Iterator
end,
const Value & open,
const Value & close ) {
259 if (
res.first ==
res.second )
277template <
typename T >
278constexpr const T &
max (
const T & a ) {
295template <
typename T,
typename ... Args >
296constexpr const T &
max (
const T & a,
const T & b,
const Args & ... args ) {
297 return max ( b < a ? a : b, args ... );
309template <
typename T >
310constexpr const T &
min (
const T & a) {
327template <
typename T,
typename ... Args >
328constexpr const T &
min (
const T & a,
const T & b,
const Args & ... args) {
329 return min ( b > a ? a : b, args ... );
336template <
typename ForwardIterator,
typename BinaryPredicate >
340 ForwardIterator next = first;
341 while ( ++ next != last ) {
342 if ( binary_pred ( * first, * next ) )
353template <
typename ForwardIterator,
typename BinaryPredicate >
354ForwardIterator
unique_internal ( ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred ) {
361 ForwardIterator dest = first;
363 while ( ++ first != last )
364 if ( ! binary_pred ( * dest, * first ) )
383template <
typename ForwardIterator >
384inline ForwardIterator
unique ( ForwardIterator first, ForwardIterator last ) {
385 return ext::unique_internal(first, last, [] (
const auto & a,
const auto & b ) {
return a == b; } );
403template <
typename ForwardIterator,
typename BinaryPredicate >
404inline ForwardIterator
unique ( ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred ) {
416template <
class ForwardIteratorBegin,
class ForwardIteratorEnd,
class ForwardCand
idateIterator >
417inline bool range_contains_iterator ( ForwardIteratorBegin from,
const ForwardIteratorEnd &
end,
const ForwardCandidateIterator & candidate ) {
418 for ( ; from !=
end; ++ from )
419 if (
static_cast < const void *
> ( std::addressof ( * from ) ) ==
static_cast < const void *
> ( std::addressof ( * candidate ) ) )
return res
Definition: MinimizeByPartitioning.h:145
Definition: sigHandler.cpp:20
auto end(Container &&cont) -> decltype(std::forward(cont).end())
Definition: iterator.hpp:912
std::pair< Iterator, Iterator > find_range_internal(Iterator begin, Iterator end, const Value &open, const Value &close)
Function to locate pair of iterators (openPos, closePos), i.e. both openPos and closePos are included...
Definition: algorithm.hpp:209
ForwardIterator unique(ForwardIterator first, ForwardIterator last)
Shuffles values in a sequece so that consecutive duplicate values are pushed to the front and others ...
Definition: algorithm.hpp:384
bool range_contains_iterator(ForwardIteratorBegin from, const ForwardIteratorEnd &end, const ForwardCandidateIterator &candidate)
determines if iterator candidate is in range [from, to).
Definition: algorithm.hpp:417
ForwardIterator adjacent_find_internal(ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred)
Internal function of standard library.
Definition: algorithm.hpp:337
constexpr const T & max(const T &a)
Root case of maximum computation. The maximum from one value is the value itself.
Definition: algorithm.hpp:278
constexpr const T & min(const T &a)
Definition: algorithm.hpp:310
bool excludes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp)
Tests two sorted ranges wheter all elements from the second are not present in the first.
Definition: algorithm.hpp:46
std::pair< Iterator, Iterator > find_range(Iterator begin, Iterator end, const Value &open, const Value &close)
Function to locate pair of iterators (openPos, closePos] where * openPos == open and closePos == clos...
Definition: algorithm.hpp:256
bool contains(InputIt first, InputIt last, const Element &elem)
Linear version of search in a range of values.
Definition: algorithm.hpp:170
ContainerType< ResType > transform(const ContainerType< InType, Ts ... > &in, Callback transform)
In container tranformation of all elements according to the tranform.
Definition: algorithm.hpp:150
void set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator1 result1, OutputIterator2 result2, Compare comp)
Constructs sorted ranges beginning in the location pointed by result1 and result2 with the set differ...
Definition: algorithm.hpp:93
bool binary_contains(InputIt first, InputIt last, const Element &elem)
Logaritmic version of search in a range of sorted values.
Definition: algorithm.hpp:188
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
ForwardIterator unique_internal(ForwardIterator first, ForwardIterator last, BinaryPredicate binary_pred)
Internal function of standard library tuned to handle swapping of pointers.
Definition: algorithm.hpp:354
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
void swap(ext::managed_linear_set< T, Compare, Alloc > &x, ext::managed_linear_set< T, Compare, Alloc > &y)
Specialisation of swap for linear set.
Definition: managed_linear_set.hpp:864