unordered_set 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // -*-c++-*-
  2. // vim: set ft=cpp:
  3. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  4. file Copyright.txt or https://cmake.org/licensing for details. */
  5. #pragma once
  6. #include <unordered_set> // IWYU pragma: export
  7. #include <cm/bits/erase_if.hxx>
  8. namespace cm {
  9. // should be updated when C++20 is finalized
  10. #if (__cplusplus > 201703L || \
  11. (defined(_MSVC_LANG) && _MSVC_LANG > 201703)) && \
  12. defined(__cpp_lib_erase_if)
  13. using std::erase_if;
  14. #else
  15. template <typename Key, typename Hash, typename KeyEqual, typename Allocator,
  16. typename Predicate>
  17. inline void erase_if(std::unordered_set<Key, Hash, KeyEqual, Allocator>& cont,
  18. Predicate pred)
  19. {
  20. internals::erase_if(cont, pred);
  21. }
  22. template <typename Key, typename Hash, typename KeyEqual, typename Allocator,
  23. typename Predicate>
  24. inline void erase_if(
  25. std::unordered_multiset<Key, Hash, KeyEqual, Allocator>& cont,
  26. Predicate pred)
  27. {
  28. internals::erase_if(cont, pred);
  29. }
  30. #endif
  31. } // namespace cm