1
//////////////////////////////////////////////////////////////////////////////
2
// (C) Copyright John Maddock 2000.
3
// (C) Copyright Ion Gaztanaga 2005-2012.
5
// Distributed under the Boost Software License, Version 1.0.
6
// (See accompanying file LICENSE_1_0.txt or copy at
7
// http://www.boost.org/LICENSE_1_0.txt)
9
// See http://www.boost.org/libs/container for documentation.
11
// The alignment_of implementation comes from John Maddock's boost::alignment_of code
13
//////////////////////////////////////////////////////////////////////////////
15
#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
16
#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
22
#include "config_begin.hpp"
24
#include <boost/move/utility.hpp>
28
namespace container_detail {
33
struct LowPriorityConversion
35
// Convertible from T with user-defined-conversion rank.
36
LowPriorityConversion(const U&) { }
39
//boost::alignment_of yields to 10K lines of preprocessed code, so we
41
template <typename T> struct alignment_of;
44
struct alignment_of_hack
51
template <unsigned A, unsigned S>
52
struct alignment_logic
54
enum{ value = A < S ? A : S };
57
template< typename T >
60
enum{ value = alignment_logic
61
< sizeof(alignment_of_hack<T>) - sizeof(T)
62
, sizeof(T)>::value };
65
//This is not standard, but should work with all compilers
72
#ifdef BOOST_HAS_LONG_LONG
77
long double long_double_;
82
struct remove_reference
88
struct remove_reference<T&>
93
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
96
struct remove_reference<T&&>
104
struct remove_reference< ::boost::rv<T> >
114
enum { value = false };
118
struct is_reference<T&>
120
enum { value = true };
126
enum { value = false };
130
struct is_pointer<T*>
132
enum { value = true };
135
template <typename T>
142
struct add_reference<T&>
148
struct add_reference<void>
154
struct add_reference<const void>
156
typedef const nat &type;
160
struct add_const_reference
161
{ typedef const T &type; };
164
struct add_const_reference<T&>
165
{ typedef T& type; };
167
template <typename T, typename U>
170
typedef char yes_type;
176
template <typename V>
177
static yes_type is_same_tester(V*, V*);
178
static no_type is_same_tester(...);
183
static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
193
struct remove_const< const T>
199
struct remove_ref_const
201
typedef typename remove_const< typename remove_reference<T>::type >::type type;
204
} // namespace container_detail
205
} //namespace container {
206
} //namespace boost {
208
#include <boost/container/detail/config_end.hpp>
210
#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP