flat_map.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_CONTAINER_PMR_FLAT_MAP_HPP
  11. #define BOOST_CONTAINER_PMR_FLAT_MAP_HPP
  12. #if defined (_MSC_VER)
  13. # pragma once
  14. #endif
  15. #include <boost/container/flat_map.hpp>
  16. #include <boost/container/pmr/polymorphic_allocator.hpp>
  17. namespace boost {
  18. namespace container {
  19. namespace pmr {
  20. #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
  21. template <class Key
  22. ,class T
  23. ,class Compare = std::less<Key > >
  24. using flat_map = boost::container::flat_map<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > >;
  25. template <class Key
  26. ,class T
  27. ,class Compare = std::less<Key> >
  28. using flat_multimap = boost::container::flat_multimap<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > >;
  29. #endif
  30. //! A portable metafunction to obtain a flat_map
  31. //! that uses a polymorphic allocator
  32. template <class Key
  33. ,class T
  34. ,class Compare = std::less<Key> >
  35. struct flat_map_of
  36. {
  37. typedef boost::container::flat_map<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > > type;
  38. };
  39. //! A portable metafunction to obtain a flat_multimap
  40. //! that uses a polymorphic allocator
  41. template <class Key
  42. ,class T
  43. ,class Compare = std::less<Key> >
  44. struct flat_multimap_of
  45. {
  46. typedef boost::container::flat_multimap<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > > type;
  47. };
  48. } //namespace pmr {
  49. } //namespace container {
  50. } //namespace boost {
  51. #endif //BOOST_CONTAINER_PMR_FLAT_MAP_HPP