Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/container/detail/container_rebind.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost
0004 // Software License, Version 1.0. (See accompanying file
0005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // See http://www.boost.org/libs/container for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 #ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
0011 #define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
0012 
0013 #ifndef BOOST_CONFIG_HPP
0014 #  include <boost/config.hpp>
0015 #endif
0016 
0017 #if defined(BOOST_HAS_PRAGMA_ONCE)
0018 #  pragma once
0019 #endif
0020 
0021 #include <boost/container/allocator_traits.hpp>
0022 #include <boost/container/container_fwd.hpp>
0023 
0024 
0025 namespace boost {
0026 namespace container {
0027 namespace dtl {
0028 
0029    template<class V, class A, class U>
0030    struct void_or_portable_rebind_alloc
0031    {
0032       typedef typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type type;
0033    };
0034 
0035    template<class V, class U>
0036    struct void_or_portable_rebind_alloc<V, void, U>
0037    {  typedef void type;  };
0038 
0039    template <class Cont, class U>
0040    struct container_rebind;
0041 
0042 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0043 
0044    template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U>
0045    struct container_rebind<Cont<V, A, An...>, U>
0046    {
0047       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, An...> type;
0048    };
0049 
0050    //Needed for non-conforming compilers like GCC 4.3
0051    template <template <class, class> class Cont, typename V, typename A, class U>
0052    struct container_rebind<Cont<V, A>, U>
0053    {
0054       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type> type;
0055    };
0056 
0057    template <template <class> class Cont, typename V, class U>
0058    struct container_rebind<Cont<V>, U>
0059    {
0060       typedef Cont<U> type;
0061    };
0062 
0063 #else //C++03 compilers
0064 
0065    template <template <class> class Cont  //0arg
0066       , typename V
0067       , class U>
0068       struct container_rebind<Cont<V>, U>
0069    {
0070       typedef Cont<U> type;
0071    };
0072 
0073    template <template <class, class> class Cont  //0arg
0074       , typename V, typename A
0075       , class U>
0076       struct container_rebind<Cont<V, A>, U>
0077    {
0078       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type> type;
0079    };
0080 
0081    template <template <class, class, class> class Cont  //1arg
0082       , typename V, typename A, class P0
0083       , class U>
0084       struct container_rebind<Cont<V, A, P0>, U>
0085    {
0086       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0> type;
0087    };
0088 
0089    template <template <class, class, class, class> class Cont  //2arg
0090       , typename V, typename A, class P0, class P1
0091       , class U>
0092       struct container_rebind<Cont<V, A, P0, P1>, U>
0093    {
0094       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1> type;
0095    };
0096 
0097    template <template <class, class, class, class, class> class Cont  //3arg
0098       , typename V, typename A, class P0, class P1, class P2
0099       , class U>
0100       struct container_rebind<Cont<V, A, P0, P1, P2>, U>
0101    {
0102       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2> type;
0103    };
0104 
0105    template <template <class, class, class, class, class, class> class Cont  //4arg
0106       , typename V, typename A, class P0, class P1, class P2, class P3
0107       , class U>
0108       struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U>
0109    {
0110       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2, P3> type;
0111    };
0112 
0113    template <template <class, class, class, class, class, class, class> class Cont  //5arg
0114       , typename V, typename A, class P0, class P1, class P2, class P3, class P4
0115       , class U>
0116       struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U>
0117    {
0118       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2, P3, P4> type;
0119    };
0120 
0121    template <template <class, class, class, class, class, class, class, class> class Cont  //6arg
0122       , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5
0123       , class U>
0124       struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
0125    {
0126       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2, P3, P4, P5> type;
0127    };
0128 
0129    template <template <class, class, class, class, class, class, class, class, class> class Cont  //7arg
0130       , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
0131       , class U>
0132       struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
0133    {
0134       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2, P3, P4, P5, P6> type;
0135    };
0136 
0137    template <template <class, class, class, class, class, class, class, class, class, class> class Cont  //8arg
0138       , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
0139       , class U>
0140       struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
0141    {
0142       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
0143    };
0144 
0145    template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont  //9arg
0146       , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
0147       , class U>
0148       struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
0149    {
0150       typedef Cont<U, typename void_or_portable_rebind_alloc<V, A, U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
0151    };
0152 
0153 #endif   //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
0154 
0155    //for small_vector,static_vector
0156 
0157    template <typename V, std::size_t N, typename A, typename O, class U>
0158    struct container_rebind<small_vector<V, N, A, O>, U>
0159    {
0160       typedef small_vector<U, N, typename void_or_portable_rebind_alloc<V, A, U>::type, O> type;
0161    };
0162 
0163    template <typename V, std::size_t N, typename O, class U>
0164    struct container_rebind<static_vector<V, N, O>, U>
0165    {
0166       typedef static_vector<U, N, O> type;
0167    };
0168 
0169 }  //namespace dtl {
0170 }  //namespace container {
0171 }  //namespace boost {
0172 
0173 #endif   //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP