alloc_helpers.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2014-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_DETAIL_ALLOC_TRAITS_HPP
  11. #define BOOST_CONTAINER_DETAIL_ALLOC_TRAITS_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #if defined(BOOST_HAS_PRAGMA_ONCE)
  16. # pragma once
  17. #endif
  18. // move
  19. #include <boost/move/adl_move_swap.hpp>
  20. #include <boost/move/utility_core.hpp>
  21. namespace boost {
  22. namespace container {
  23. namespace dtl {
  24. template<class AllocatorType>
  25. inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type)
  26. BOOST_NOEXCEPT_OR_NOTHROW
  27. {}
  28. template<class AllocatorType>
  29. inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type)
  30. { boost::adl_move_swap(l, r); }
  31. template<class AllocatorType>
  32. inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type)
  33. BOOST_NOEXCEPT_OR_NOTHROW
  34. {}
  35. template<class AllocatorType>
  36. inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type)
  37. { l = r; }
  38. template<class AllocatorType>
  39. inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type)
  40. BOOST_NOEXCEPT_OR_NOTHROW
  41. {}
  42. template<class AllocatorType>
  43. inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type)
  44. { l = ::boost::move(r); }
  45. } //namespace dtl {
  46. } //namespace container {
  47. } //namespace boost {
  48. #endif //#ifndef BOOST_CONTAINER_DETAIL_ALLOC_TRAITS_HPP