/usr/include/boost/intrusive
Edit: /usr/include/boost/intrusive/pointer_rebind.hpp (6306B)
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2014-2014. 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/intrusive for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_POINTER_REBIND_HPP
#define BOOST_INTRUSIVE_POINTER_REBIND_HPP
#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP
#include
#endif //BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP
#ifndef BOOST_CONFIG_HPP
# include
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
namespace boost {
namespace intrusive {
///////////////////////////
//struct pointer_rebind_mode
///////////////////////////
template
struct pointer_has_rebind
{
template struct any
{ any(const V&) { } };
template
static char test(int, typename X::template rebind*);
template
static int test(any, void*);
static const bool value = (1 == sizeof(test(0, 0)));
};
template
struct pointer_has_rebind_other
{
template struct any
{ any(const V&) { } };
template
static char test(int, typename X::template rebind::other*);
template
static int test(any, void*);
static const bool value = (1 == sizeof(test(0, 0)));
};
template
struct pointer_rebind_mode
{
static const unsigned int rebind = (unsigned int)pointer_has_rebind::value;
static const unsigned int rebind_other = (unsigned int)pointer_has_rebind_other::value;
static const unsigned int mode = rebind + rebind*rebind_other;
};
////////////////////////
//struct pointer_rebinder
////////////////////////
template
struct pointer_rebinder;
// Implementation of pointer_rebinder::type if Ptr has
// its own rebind::other type (C++03)
template
struct pointer_rebinder< Ptr, U, 2u >
{
typedef typename Ptr::template rebind::other type;
};
// Implementation of pointer_rebinder::type if Ptr has
// its own rebind template.
template
struct pointer_rebinder< Ptr, U, 1u >
{
typedef typename Ptr::template rebind type;
};
// Specialization of pointer_rebinder if Ptr does not
// have its own rebind template but has a the form Ptr,
// where An... comprises zero or more type parameters.
// Many types fit this form, hence many pointers will get a
// reasonable default for rebind.
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template class Ptr, typename A, class... An, class U>
struct pointer_rebinder, U, 0u >
{
typedef Ptr type;
};
//Needed for non-conforming compilers like GCC 4.3
template class Ptr, typename A, class U>
struct pointer_rebinder, U, 0u >
{
typedef Ptr type;
};
#else //C++03 compilers
template class Ptr //0arg
, typename A
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //1arg
, typename A, class P0
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //2arg
, typename A, class P0, class P1
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //3arg
, typename A, class P0, class P1, class P2
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //4arg
, typename A, class P0, class P1, class P2, class P3
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //5arg
, typename A, class P0, class P1, class P2, class P3, class P4
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //6arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //7arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //8arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
template class Ptr //9arg
, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
, class U>
struct pointer_rebinder, U, 0u>
{ typedef Ptr type; };
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template
struct pointer_rebind
: public pointer_rebinder::mode>
{};
template
struct pointer_rebind
{ typedef U* type; };
} //namespace container {
} //namespace boost {
#endif // defined(BOOST_INTRUSIVE_POINTER_REBIND_HPP)