set 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef cm_set
  6. #define cm_set
  7. #include <set> // IWYU pragma: export
  8. #include <cm/bits/erase_if.hxx>
  9. namespace cm {
  10. // should be updated when C++20 is finalized
  11. #if (__cplusplus > 201703L || \
  12. (defined(_MSVC_LANG) && _MSVC_LANG > 201703)) && \
  13. defined(__cpp_lib_erase_if)
  14. using std::erase_if;
  15. #else
  16. template <typename Key, typename Compare, typename Allocator,
  17. typename Predicate>
  18. inline void erase_if(std::set<Key, Compare, Allocator>& cont, Predicate pred)
  19. {
  20. internals::erase_if(cont, pred);
  21. }
  22. template <typename Key, typename Compare, typename Allocator,
  23. typename Predicate>
  24. inline void erase_if(std::multiset<Key, Compare, Allocator>& cont,
  25. Predicate pred)
  26. {
  27. internals::erase_if(cont, pred);
  28. }
  29. #endif
  30. } // namespace cm
  31. #endif