alloc_helpers.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include <boost/container/detail/mpl.hpp>
  22. namespace boost {
  23. namespace container {
  24. namespace dtl {
  25. template<class AllocatorType>
  26. inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type)
  27. BOOST_NOEXCEPT_OR_NOTHROW
  28. {}
  29. template<class AllocatorType>
  30. inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type)
  31. { boost::adl_move_swap(l, r); }
  32. template<class AllocatorType>
  33. inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type)
  34. BOOST_NOEXCEPT_OR_NOTHROW
  35. {}
  36. template<class AllocatorType>
  37. inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type)
  38. { l = r; }
  39. template<class AllocatorType>
  40. inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type)
  41. BOOST_NOEXCEPT_OR_NOTHROW
  42. {}
  43. template<class AllocatorType>
  44. inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type)
  45. { l = ::boost::move(r); }
  46. } //namespace dtl {
  47. } //namespace container {
  48. } //namespace boost {
  49. #endif //#ifndef BOOST_CONTAINER_DETAIL_ALLOC_TRAITS_HPP