2018-01-01 20:31:13 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost
|
|
|
|
// Software License, Version 1.0. (See accompanying file
|
|
|
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
// See http://www.boost.org/libs/container for documentation.
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
|
|
|
|
#define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
|
|
|
|
|
|
|
|
#ifndef BOOST_CONFIG_HPP
|
|
|
|
# include <boost/config.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
|
|
|
# pragma once
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <boost/container/allocator_traits.hpp>
|
2019-08-24 13:39:04 +00:00
|
|
|
#include <boost/container/container_fwd.hpp>
|
2018-01-01 20:31:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
namespace container {
|
2018-08-21 16:04:16 +00:00
|
|
|
namespace dtl {
|
2018-01-01 20:31:13 +00:00
|
|
|
|
|
|
|
template <class Cont, class U>
|
|
|
|
struct container_rebind;
|
|
|
|
|
|
|
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
|
|
|
|
|
|
|
template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U>
|
|
|
|
struct container_rebind<Cont<V, A, An...>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, An...> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//Needed for non-conforming compilers like GCC 4.3
|
|
|
|
template <template <class, class> class Cont, typename V, typename A, class U>
|
|
|
|
struct container_rebind<Cont<V, A>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class> class Cont, typename V, class U>
|
|
|
|
struct container_rebind<Cont<V>, U>
|
|
|
|
{
|
|
|
|
typedef Cont<U> type;
|
|
|
|
};
|
|
|
|
|
|
|
|
#else //C++03 compilers
|
|
|
|
|
|
|
|
template <template <class> class Cont //0arg
|
|
|
|
, typename V
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V>, U>
|
|
|
|
{
|
|
|
|
typedef Cont<U> type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class> class Cont //0arg
|
|
|
|
, typename V, typename A
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class> class Cont //1arg
|
|
|
|
, typename V, typename A, class P0
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class> class Cont //2arg
|
|
|
|
, typename V, typename A, class P0, class P1
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class> class Cont //3arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class, class> class Cont //4arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2, class P3
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class, class, class> class Cont //5arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2, class P3, class P4
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class, class, class, class> class Cont //6arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class, class, class, class, class> class Cont //7arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class, class, class, class, class, class> class Cont //8arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont //9arg
|
|
|
|
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
|
|
|
|
, class U>
|
|
|
|
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
|
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
2019-08-24 13:39:04 +00:00
|
|
|
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
2018-01-01 20:31:13 +00:00
|
|
|
|
2019-08-24 13:39:04 +00:00
|
|
|
//for small_vector,static_vector
|
2018-01-01 20:31:13 +00:00
|
|
|
|
2019-08-24 13:39:04 +00:00
|
|
|
template <typename V, std::size_t N, typename A, class U>
|
|
|
|
struct container_rebind<small_vector<V, N, A>, U>
|
2018-01-01 20:31:13 +00:00
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef small_vector<U, N, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
2019-08-24 13:39:04 +00:00
|
|
|
template <typename V, std::size_t N, typename O, class U>
|
|
|
|
struct container_rebind<static_vector<V, N, O>, U>
|
2018-01-01 20:31:13 +00:00
|
|
|
{
|
2019-08-24 13:39:04 +00:00
|
|
|
typedef static_vector<U, N, O> type;
|
2018-01-01 20:31:13 +00:00
|
|
|
};
|
|
|
|
|
2018-08-21 16:04:16 +00:00
|
|
|
} //namespace dtl {
|
2018-01-01 20:31:13 +00:00
|
|
|
} //namespace container {
|
|
|
|
} //namespace boost {
|
|
|
|
|
|
|
|
#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
|