ReactOS 0.4.15-dev-7704-gc07eb9f
boost_type_traits.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) 2004
4 * Francois Dumont
5 *
6 * This material is provided "as is", with absolutely no warranty expressed
7 * or implied. Any use is at your own risk.
8 *
9 * Permission to use or copy this software for any purpose is hereby granted
10 * without fee, provided the above notices are retained on all copies.
11 * Permission to modify the code and to distribute modified code is granted,
12 * provided the above notices are retained, and a notice that the code was
13 * modified is included with the above copyright notice.
14 *
15 */
16
17#ifndef _STLP_BOOST_TYPE_TRAITS_H
18#define _STLP_BOOST_TYPE_TRAITS_H
19
20#ifndef BOOST_CONFIG_SUFFIX_HPP
21# ifdef BOOST_CONFIG_HPP
22# undef BOOST_CONFIG_HPP
23# endif
24# include <boost/config.hpp>
25#endif
26
27#include <boost/type_traits/is_integral.hpp>
28#include <boost/type_traits/is_float.hpp>
29#include <boost/type_traits/has_trivial_constructor.hpp>
30#include <boost/type_traits/has_trivial_copy.hpp>
31#include <boost/type_traits/has_trivial_assign.hpp>
32#include <boost/type_traits/has_trivial_destructor.hpp>
33#include <boost/type_traits/is_pod.hpp>
34#include <boost/type_traits/is_pointer.hpp>
35#include <boost/type_traits/is_reference.hpp>
36#include <boost/type_traits/remove_cv.hpp>
37#include <boost/type_traits/is_same.hpp>
38
39/*
40 * This file mostly wraps boost type_traits in the STLport type_traits.
41 * When checking a type traits like trivial assign operator for instance
42 * both the boost value and STLport values has to be taken into account
43 * as we don't know what the user might have prefer, specializing the boost
44 * type traits or the STLport one.
45 */
47
48template <class _Tp> struct _IsRef {
49 enum { _Is = ::boost::is_reference<_Tp>::value };
50 typedef typename __bool2type<_Is>::_Ret _Ret;
51};
52
53template <class _Tp> struct _IsPtr {
54 enum { is_pointer = ::boost::is_pointer<_Tp>::value };
56};
57
58template <class _Tp> struct _IsIntegral {
59 enum { is_integral = ::boost::is_integral<_Tp>::value };
61};
62
63template <class _Tp> struct _IsRational {
64 enum { is_float = ::boost::is_float<_Tp>::value };
66};
67
68template <class _Tp>
70 enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value };
72
73 enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value };
75
76 enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value };
78
79 enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value };
81
82 enum { pod = ::boost::is_pod<_Tp>::value };
84};
85
86template <class _Tp1, class _Tp2>
88 typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
89 typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
90
91 enum { same = ::boost::is_same<uncv1, uncv2>::value };
93
94 enum { boost_trivial_assign = ::boost::has_trivial_assign<uncv1>::value };
98
100 static _Type _Answer() { return _Type(); }
101};
102
103template <class _Tp1, class _Tp2>
105 typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
106 typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
107
108 enum { same = ::boost::is_same<uncv1, uncv2>::value };
110
111 enum { boost_trivial_copy = ::boost::has_trivial_copy<uncv1>::value };
115
117 static _Type _Answer() { return _Type(); }
118};
119
120template <class _Tp>
122 enum { is_integral = ::boost::is_integral<_Tp>::value };
124 enum { is_float = ::boost::is_float<_Tp>::value };
126 enum { is_pointer = ::boost::is_pointer<_Tp>::value };
128
130};
131
132template <class _Tp>
134 typedef typename ::boost::remove_cv<_Tp>::type uncv;
135
136 enum { boost_trivial_constructor = ::boost::has_trivial_constructor<uncv>::value };
140
142 typedef typename _Not<_Tr2>::_Ret _Tr3;
143
145 static _Ret _Answer() { return _Ret(); }
146};
147
149
150#endif /* _STLP_BOOST_TYPE_TRAITS_H */
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
__bool2type< is_float >::_Ret _IsFloat
__bool2type< is_pointer >::_Ret _IsPointer
__bool2type< is_integral >::_Ret _IsIntegral
_Lor3< _IsIntegral, _IsFloat, _IsPointer >::_Ret _Ret
__bool2type< is_integral >::_Ret _Ret
__bool2type< is_pointer >::_Ret _Ret
__bool2type< is_float >::_Ret _Ret
__bool2type< _Is >::_Ret _Ret
_Lor2< _BoostTrivialAssign, _STLPTrivialAssign >::_Ret _TrivialAssign
__bool2type< boost_trivial_assign >::_Ret _BoostTrivialAssign
__bool2type< same >::_Ret _Same
static _Type _Answer()
__type_traits< uncv1 >::has_trivial_assignment_operator _STLPTrivialAssign
_Land2< _Same, _TrivialAssign >::_Ret _Type
::boost::remove_cv< _Tp1 >::type uncv1
::boost::remove_cv< _Tp2 >::type uncv2
_Lor2< _BoostTrivialInit, _STLPTrivialInit >::_Ret _Tr1
_DefaultZeroValue< _Tp >::_Ret _Tr2
__type_traits< uncv >::has_trivial_default_constructor _STLPTrivialInit
_Land2< _Tr1, _Tr3 >::_Ret _Ret
__bool2type< boost_trivial_constructor >::_Ret _BoostTrivialInit
_Not< _Tr2 >::_Ret _Tr3
::boost::remove_cv< _Tp >::type uncv
static _Ret _Answer()
_Land2< _Same, _TrivialCopy >::_Ret _Type
static _Type _Answer()
_Lor2< _BoostTrivialCopy, _STLPTrivialCopy >::_Ret _TrivialCopy
__bool2type< boost_trivial_copy >::_Ret _BoostTrivialCopy
__bool2type< same >::_Ret _Same
__type_traits< uncv1 >::has_trivial_copy_constructor _STLPTrivialCopy
::boost::remove_cv< _Tp2 >::type uncv2
::boost::remove_cv< _Tp1 >::type uncv1
__bool2type< pod >::_Ret is_POD_type
__bool2type< trivial_destructor >::_Ret has_trivial_destructor
__bool2type< trivial_constructor >::_Ret has_trivial_default_constructor
__bool2type< trivial_copy >::_Ret has_trivial_copy_constructor
__bool2type< trivial_assign >::_Ret has_trivial_assignment_operator