29 #ifndef AURORA_ALGORITHMS_HPP
30 #define AURORA_ALGORITHMS_HPP
50 return !(lhs < rhs) && !(rhs < lhs);
58 template <
typename ForwardIterator,
typename T>
59 ForwardIterator
binarySearch(ForwardIterator first, ForwardIterator last,
const T& value)
62 ForwardIterator result = std::lower_bound(first, last, value);
65 if (result == last || !
equivalent(*result, value))
75 template <
typename Container,
typename Iterator>
84 template <
typename Container,
typename Value>
85 void remove(Container& c,
const Value& v)
88 c.erase(begin, c.end());
93 template <
typename Container,
typename Predicate>
94 void removeIf(Container& c,
const Predicate& p)
96 auto begin = std::remove_if(c.begin(), c.end(), p);
97 c.erase(begin, c.end());
102 template <
typename Queue>
103 typename Queue::value_type
pop(Queue& q)
105 auto value = std::move(q.front());
112 template <
typename Queue>
123 template <
typename AssocContainer,
typename Key>
124 typename AssocContainer::mapped_type&
mapAt(AssocContainer& map,
const Key& k)
126 auto itr = map.find(k);
127 assert(itr != map.end());
132 template <
typename AssocContainer,
typename Key>
133 const typename AssocContainer::mapped_type& mapAt(
const AssocContainer& map,
const Key& k)
135 auto itr = map.find(k);
136 assert(itr != map.end());
144 #endif // AURORA_ALGORITHMS_HPP
Helpers to declare and invoke swap() functions.
Definition: DispatchTraits.hpp:39