allocator_rebind_helper.hpp 910 B

1234567891011121314151617181920212223242526272829303132
  1. // boost lockfree: allocator rebind helper
  2. //
  3. // Copyright (C) 2017 Minmin Gong
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #ifndef BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED
  9. #define BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED
  10. #include <memory>
  11. namespace boost {
  12. namespace lockfree {
  13. namespace detail {
  14. template <class allocator_type, class value_type>
  15. struct allocator_rebind_helper
  16. {
  17. #if !defined( BOOST_NO_CXX11_ALLOCATOR )
  18. typedef typename std::allocator_traits<allocator_type>::template rebind_alloc<value_type> type;
  19. #else
  20. typedef typename allocator_type::template rebind<value_type>::other type;
  21. #endif
  22. };
  23. } /* namespace detail */
  24. } /* namespace lockfree */
  25. } /* namespace boost */
  26. #endif /* BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED */