ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

boost_type_traits.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (c) 2004
00004  * Francois Dumont
00005  *
00006  * This material is provided "as is", with absolutely no warranty expressed
00007  * or implied. Any use is at your own risk.
00008  *
00009  * Permission to use or copy this software for any purpose is hereby granted
00010  * without fee, provided the above notices are retained on all copies.
00011  * Permission to modify the code and to distribute modified code is granted,
00012  * provided the above notices are retained, and a notice that the code was
00013  * modified is included with the above copyright notice.
00014  *
00015  */
00016 
00017 #ifndef _STLP_BOOST_TYPE_TRAITS_H
00018 #define _STLP_BOOST_TYPE_TRAITS_H
00019 
00020 #ifndef BOOST_CONFIG_SUFFIX_HPP
00021 #  ifdef BOOST_CONFIG_HPP
00022 #    undef BOOST_CONFIG_HPP
00023 #  endif
00024 #  include <boost/config.hpp>
00025 #endif
00026 
00027 #include <boost/type_traits/is_integral.hpp>
00028 #include <boost/type_traits/is_float.hpp>
00029 #include <boost/type_traits/has_trivial_constructor.hpp>
00030 #include <boost/type_traits/has_trivial_copy.hpp>
00031 #include <boost/type_traits/has_trivial_assign.hpp>
00032 #include <boost/type_traits/has_trivial_destructor.hpp>
00033 #include <boost/type_traits/is_pod.hpp>
00034 #include <boost/type_traits/is_pointer.hpp>
00035 #include <boost/type_traits/is_reference.hpp>
00036 #include <boost/type_traits/remove_cv.hpp>
00037 #include <boost/type_traits/is_same.hpp>
00038 
00039 /*
00040  * This file mostly wraps boost type_traits in the STLport type_traits.
00041  * When checking a type traits like trivial assign operator for instance
00042  * both the boost value and STLport values has to be taken into account
00043  * as we don't know what the user might have prefer, specializing the boost
00044  * type traits or the STLport one.
00045  */
00046 _STLP_BEGIN_NAMESPACE
00047 
00048 template <class _Tp> struct _IsRef {
00049   enum { _Is = ::boost::is_reference<_Tp>::value };
00050   typedef typename __bool2type<_Is>::_Ret _Ret;
00051 };
00052 
00053 template <class _Tp> struct _IsPtr {
00054   enum { is_pointer = ::boost::is_pointer<_Tp>::value };
00055   typedef typename __bool2type<is_pointer>::_Ret _Ret;
00056 };
00057 
00058 template <class _Tp> struct _IsIntegral {
00059   enum { is_integral = ::boost::is_integral<_Tp>::value };
00060   typedef typename __bool2type<is_integral>::_Ret _Ret;
00061 };
00062 
00063 template <class _Tp> struct _IsRational {
00064   enum { is_float = ::boost::is_float<_Tp>::value };
00065   typedef typename __bool2type<is_float>::_Ret _Ret;
00066 };
00067 
00068 template <class _Tp>
00069 struct __type_traits {
00070   enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value };
00071   typedef typename __bool2type<trivial_constructor>::_Ret has_trivial_default_constructor;
00072 
00073   enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value };
00074   typedef typename __bool2type<trivial_copy>::_Ret has_trivial_copy_constructor;
00075 
00076   enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value };
00077   typedef typename __bool2type<trivial_assign>::_Ret has_trivial_assignment_operator;
00078 
00079   enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value };
00080   typedef typename __bool2type<trivial_destructor>::_Ret has_trivial_destructor;
00081 
00082   enum { pod = ::boost::is_pod<_Tp>::value };
00083   typedef typename __bool2type<pod>::_Ret is_POD_type;
00084 };
00085 
00086 template <class _Tp1, class _Tp2>
00087 struct _TrivialCopy {
00088   typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
00089   typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
00090 
00091   enum { same = ::boost::is_same<uncv1, uncv2>::value };
00092   typedef typename __bool2type<same>::_Ret _Same;
00093 
00094   enum { boost_trivial_assign = ::boost::has_trivial_assign<uncv1>::value };
00095   typedef typename __bool2type<boost_trivial_assign>::_Ret _BoostTrivialAssign;
00096   typedef typename __type_traits<uncv1>::has_trivial_assignment_operator _STLPTrivialAssign;
00097   typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign;
00098 
00099   typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type;
00100   static _Type _Answer() { return _Type(); }
00101 };
00102 
00103 template <class _Tp1, class _Tp2>
00104 struct _TrivialUCopy {
00105   typedef typename ::boost::remove_cv<_Tp1>::type uncv1;
00106   typedef typename ::boost::remove_cv<_Tp2>::type uncv2;
00107 
00108   enum { same = ::boost::is_same<uncv1, uncv2>::value };
00109   typedef typename __bool2type<same>::_Ret _Same;
00110 
00111   enum { boost_trivial_copy = ::boost::has_trivial_copy<uncv1>::value };
00112   typedef typename __bool2type<boost_trivial_copy>::_Ret _BoostTrivialCopy;
00113   typedef typename __type_traits<uncv1>::has_trivial_copy_constructor _STLPTrivialCopy;
00114   typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy;
00115 
00116   typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type;
00117   static _Type _Answer() { return _Type(); }
00118 };
00119 
00120 template <class _Tp>
00121 struct _DefaultZeroValue {
00122   enum { is_integral = ::boost::is_integral<_Tp>::value };
00123   typedef typename __bool2type<is_integral>::_Ret _IsIntegral;
00124   enum { is_float = ::boost::is_float<_Tp>::value };
00125   typedef typename __bool2type<is_float>::_Ret _IsFloat;
00126   enum { is_pointer = ::boost::is_pointer<_Tp>::value };
00127   typedef typename __bool2type<is_pointer>::_Ret _IsPointer;
00128 
00129   typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret;
00130 };
00131 
00132 template <class _Tp>
00133 struct _TrivialInit {
00134   typedef typename ::boost::remove_cv<_Tp>::type uncv;
00135 
00136   enum { boost_trivial_constructor = ::boost::has_trivial_constructor<uncv>::value };
00137   typedef typename __bool2type<boost_trivial_constructor>::_Ret _BoostTrivialInit;
00138   typedef typename __type_traits<uncv>::has_trivial_default_constructor _STLPTrivialInit;
00139   typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1;
00140 
00141   typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2;
00142   typedef typename _Not<_Tr2>::_Ret _Tr3;
00143 
00144   typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret;
00145   static _Ret _Answer() { return _Ret(); }
00146 };
00147 
00148 _STLP_END_NAMESPACE
00149 
00150 #endif /* _STLP_BOOST_TYPE_TRAITS_H */

Generated on Sun May 27 2012 04:29:47 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.