• Home
  • Raw
  • Download

Lines Matching full:container

32 template <typename Container, typename Predicate>
33 void IterateAndEraseIf(Container& container, Predicate pred) { in IterateAndEraseIf() argument
34 for (auto it = container.begin(); it != container.end();) { in IterateAndEraseIf()
36 it = container.erase(it); in IterateAndEraseIf()
46 template <typename Container>
47 constexpr auto size(const Container& c) -> decltype(c.size()) {
58 template <typename Container>
59 constexpr auto empty(const Container& c) -> decltype(c.empty()) {
75 template <typename Container>
76 constexpr auto data(Container& c) -> decltype(c.data()) {
92 template <typename Container>
93 constexpr auto data(const Container& c) -> decltype(c.data()) {
107 // Returns a const reference to the underlying container of a container adapter.
129 // Counts the number of instances of val in a container.
130 template <typename Container, typename T>
132 typename Container::const_iterator>::difference_type
133 STLCount(const Container& container, const T& val) { in STLCount() argument
134 return std::count(container.begin(), container.end(), val); in STLCount()
172 // Returns true if the container is sorted.
173 template <typename Container>
174 bool STLIsSorted(const Container& cont) { in STLIsSorted()
175 // Note: Use reverse iterator on container to ensure we only require in STLIsSorted()
178 std::less<typename Container::value_type>()) in STLIsSorted()
219 // Returns true if the sorted container |a1| contains all elements of the sorted
220 // container |a2|.
231 // They provide a generic way to erase elements from a container.
240 void Erase(std::basic_string<CharT, Traits, Allocator>& container, in Erase() argument
242 container.erase(std::remove(container.begin(), container.end(), value), in Erase()
243 container.end()); in Erase()
247 void EraseIf(std::basic_string<CharT, Traits, Allocator>& container, in EraseIf() argument
249 container.erase(std::remove_if(container.begin(), container.end(), pred), in EraseIf()
250 container.end()); in EraseIf()
254 void Erase(std::deque<T, Allocator>& container, const Value& value) { in Erase() argument
255 container.erase(std::remove(container.begin(), container.end(), value), in Erase()
256 container.end()); in Erase()
260 void EraseIf(std::deque<T, Allocator>& container, Predicate pred) { in EraseIf() argument
261 container.erase(std::remove_if(container.begin(), container.end(), pred), in EraseIf()
262 container.end()); in EraseIf()
266 void Erase(std::vector<T, Allocator>& container, const Value& value) { in Erase() argument
267 container.erase(std::remove(container.begin(), container.end(), value), in Erase()
268 container.end()); in Erase()
272 void EraseIf(std::vector<T, Allocator>& container, Predicate pred) { in EraseIf() argument
273 container.erase(std::remove_if(container.begin(), container.end(), pred), in EraseIf()
274 container.end()); in EraseIf()
278 void Erase(std::forward_list<T, Allocator>& container, const Value& value) { in Erase() argument
280 // heterogeneous types and does not force a conversion to the container's in Erase()
282 container.remove_if([&](const T& cur) { return cur == value; }); in Erase()
286 void EraseIf(std::forward_list<T, Allocator>& container, Predicate pred) { in EraseIf() argument
287 container.remove_if(pred); in EraseIf()
291 void Erase(std::list<T, Allocator>& container, const Value& value) { in Erase() argument
293 // types and does not force a conversion to the container's value type before in Erase()
295 container.remove_if([&](const T& cur) { return cur == value; }); in Erase()
299 void EraseIf(std::list<T, Allocator>& container, Predicate pred) { in EraseIf() argument
300 container.remove_if(pred); in EraseIf()
304 void EraseIf(std::map<Key, T, Compare, Allocator>& container, Predicate pred) { in EraseIf() argument
305 internal::IterateAndEraseIf(container, pred); in EraseIf()
309 void EraseIf(std::multimap<Key, T, Compare, Allocator>& container, in EraseIf() argument
311 internal::IterateAndEraseIf(container, pred); in EraseIf()
315 void EraseIf(std::set<Key, Compare, Allocator>& container, Predicate pred) { in EraseIf() argument
316 internal::IterateAndEraseIf(container, pred); in EraseIf()
320 void EraseIf(std::multiset<Key, Compare, Allocator>& container, in EraseIf() argument
322 internal::IterateAndEraseIf(container, pred); in EraseIf()
331 void EraseIf(std::unordered_map<Key, T, Hash, KeyEqual, Allocator>& container, in EraseIf() argument
333 internal::IterateAndEraseIf(container, pred); in EraseIf()
343 std::unordered_multimap<Key, T, Hash, KeyEqual, Allocator>& container, in EraseIf() argument
345 internal::IterateAndEraseIf(container, pred); in EraseIf()
353 void EraseIf(std::unordered_set<Key, Hash, KeyEqual, Allocator>& container, in EraseIf() argument
355 internal::IterateAndEraseIf(container, pred); in EraseIf()
363 void EraseIf(std::unordered_multiset<Key, Hash, KeyEqual, Allocator>& container, in EraseIf() argument
365 internal::IterateAndEraseIf(container, pred); in EraseIf()
370 // each container an element at a time, erasing elements from the first
371 // container if they aren't in the second container. Requires each container be