• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2017-2017. 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_CONTAINER_OR_ALLOCATOR_REBIND_HPP
11 #define BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP
12 
13 #ifndef BOOST_CONFIG_HPP
14 #  include <boost/config.hpp>
15 #endif
16 
17 #if defined(BOOST_HAS_PRAGMA_ONCE)
18 #  pragma once
19 #endif
20 
21 #include <boost/container/allocator_traits.hpp>
22 #include <boost/container/detail/container_rebind.hpp>
23 #include <boost/container/detail/is_container.hpp>
24 
25 namespace boost {
26 namespace container {
27 namespace dtl {
28 
29 template<class AllocatorOrContainer, class ToType, bool = is_container<AllocatorOrContainer>::value>
30 struct container_or_allocator_rebind_impl
31    : container_rebind<AllocatorOrContainer, ToType>
32 {};
33 
34 template<class AllocatorOrContainer, class ToType>
35 struct container_or_allocator_rebind_impl<AllocatorOrContainer, ToType, false>
36    : allocator_traits<AllocatorOrContainer>::template portable_rebind_alloc<ToType>
37 {};
38 
39 template<class ToType>
40 struct container_or_allocator_rebind_impl<void, ToType, false>
41    : real_allocator<ToType, void>
42 {};
43 
44 template<class AllocatorOrContainer, class ToType>
45 struct container_or_allocator_rebind
46    : container_or_allocator_rebind_impl<AllocatorOrContainer, ToType>
47 {};
48 
49 }  //namespace dtl {
50 }  //namespace container {
51 }  //namespace boost {
52 
53 #endif   //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP
54