~ubuntu-branches/ubuntu/wily/davix/wily

« back to all changes in this revision

Viewing changes to deps/boost_intern/boost/container/detail/type_traits.hpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2015-07-31 13:17:55 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20150731131755-mizprbmn7ogv33te
Tags: 0.4.1-1
* Update to version 0.4.1
* Implement Multi-Arch support

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//////////////////////////////////////////////////////////////////////////////
2
 
// (C) Copyright John Maddock 2000.
3
 
// (C) Copyright Ion Gaztanaga 2005-2012.
4
 
//
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)
8
 
//
9
 
// See http://www.boost.org/libs/container for documentation.
10
 
//
11
 
// The alignment_of implementation comes from John Maddock's boost::alignment_of code
12
 
//
13
 
//////////////////////////////////////////////////////////////////////////////
14
 
 
15
 
#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
16
 
#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
17
 
 
18
 
#if defined(_MSC_VER)
19
 
#  pragma once
20
 
#endif
21
 
 
22
 
#include "config_begin.hpp"
23
 
 
24
 
#include <boost/move/utility.hpp>
25
 
 
26
 
namespace boost {
27
 
namespace container {
28
 
namespace container_detail {
29
 
 
30
 
struct nat{};
31
 
 
32
 
template <typename U>
33
 
struct LowPriorityConversion
34
 
{
35
 
   // Convertible from T with user-defined-conversion rank.
36
 
   LowPriorityConversion(const U&) { }
37
 
};
38
 
 
39
 
//boost::alignment_of yields to 10K lines of preprocessed code, so we
40
 
//need an alternative
41
 
template <typename T> struct alignment_of;
42
 
 
43
 
template <typename T>
44
 
struct alignment_of_hack
45
 
{
46
 
    char c;
47
 
    T t;
48
 
    alignment_of_hack();
49
 
};
50
 
 
51
 
template <unsigned A, unsigned S>
52
 
struct alignment_logic
53
 
{
54
 
    enum{   value = A < S ? A : S  };
55
 
};
56
 
 
57
 
template< typename T >
58
 
struct alignment_of
59
 
{
60
 
   enum{ value = alignment_logic
61
 
            < sizeof(alignment_of_hack<T>) - sizeof(T)
62
 
            , sizeof(T)>::value   };
63
 
};
64
 
 
65
 
//This is not standard, but should work with all compilers
66
 
union max_align
67
 
{
68
 
   char        char_;
69
 
   short       short_;
70
 
   int         int_;
71
 
   long        long_;
72
 
   #ifdef BOOST_HAS_LONG_LONG
73
 
   long long   long_long_;
74
 
   #endif
75
 
   float       float_;
76
 
   double      double_;
77
 
   long double long_double_;
78
 
   void *      void_ptr_;
79
 
};
80
 
 
81
 
template<class T>
82
 
struct remove_reference
83
 
{
84
 
   typedef T type;
85
 
};
86
 
 
87
 
template<class T>
88
 
struct remove_reference<T&>
89
 
{
90
 
   typedef T type;
91
 
};
92
 
 
93
 
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
94
 
 
95
 
template<class T>
96
 
struct remove_reference<T&&>
97
 
{
98
 
   typedef T type;
99
 
};
100
 
 
101
 
#else
102
 
 
103
 
template<class T>
104
 
struct remove_reference< ::boost::rv<T> >
105
 
{
106
 
   typedef T type;
107
 
};
108
 
 
109
 
#endif
110
 
 
111
 
template<class T>
112
 
struct is_reference
113
 
{
114
 
   enum {  value = false   };
115
 
};
116
 
 
117
 
template<class T>
118
 
struct is_reference<T&>
119
 
{
120
 
   enum {  value = true   };
121
 
};
122
 
 
123
 
template<class T>
124
 
struct is_pointer
125
 
{
126
 
   enum {  value = false   };
127
 
};
128
 
 
129
 
template<class T>
130
 
struct is_pointer<T*>
131
 
{
132
 
   enum {  value = true   };
133
 
};
134
 
 
135
 
template <typename T>
136
 
struct add_reference
137
 
{
138
 
    typedef T& type;
139
 
};
140
 
 
141
 
template<class T>
142
 
struct add_reference<T&>
143
 
{
144
 
    typedef T& type;
145
 
};
146
 
 
147
 
template<>
148
 
struct add_reference<void>
149
 
{
150
 
    typedef nat &type;
151
 
};
152
 
 
153
 
template<>
154
 
struct add_reference<const void>
155
 
{
156
 
    typedef const nat &type;
157
 
};
158
 
 
159
 
template <class T>
160
 
struct add_const_reference
161
 
{  typedef const T &type;   };
162
 
 
163
 
template <class T>
164
 
struct add_const_reference<T&>
165
 
{  typedef T& type;   };
166
 
 
167
 
template <typename T, typename U>
168
 
struct is_same
169
 
{
170
 
   typedef char yes_type;
171
 
   struct no_type
172
 
   {
173
 
      char padding[8];
174
 
   };
175
 
 
176
 
   template <typename V>
177
 
   static yes_type is_same_tester(V*, V*);
178
 
   static no_type is_same_tester(...);
179
 
 
180
 
   static T *t;
181
 
   static U *u;
182
 
 
183
 
   static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
184
 
};
185
 
 
186
 
template<class T>
187
 
struct remove_const
188
 
{
189
 
   typedef T type;
190
 
};
191
 
 
192
 
template<class T>
193
 
struct remove_const< const T>
194
 
{
195
 
   typedef T type;
196
 
};
197
 
 
198
 
template<class T>
199
 
struct remove_ref_const
200
 
{
201
 
   typedef typename remove_const< typename remove_reference<T>::type >::type type;
202
 
};
203
 
 
204
 
} // namespace container_detail
205
 
}  //namespace container {
206
 
}  //namespace boost {
207
 
 
208
 
#include <boost/container/detail/config_end.hpp>
209
 
 
210
 
#endif   //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP