Go to the documentation of this file.00001
00002
00003
00004 #ifndef IS_INCREMENTABLE_DWA200415_HPP
00005 # define IS_INCREMENTABLE_DWA200415_HPP
00006
00007 # include <boost/type_traits/detail/template_arity_spec.hpp>
00008 # include <boost/type_traits/remove_cv.hpp>
00009 # include <boost/mpl/aux_/lambda_support.hpp>
00010 # include <boost/mpl/bool.hpp>
00011 # include <boost/detail/workaround.hpp>
00012
00013
00014 # include <boost/type_traits/detail/bool_trait_def.hpp>
00015
00016 namespace boost { namespace detail {
00017
00018
00019
00020
00021
00022
00023
00024
00025 namespace is_incrementable_
00026 {
00027
00028
00029 struct tag {};
00030
00031
00032
00033
00034 struct any { template <class T> any(T const&); };
00035
00036
00037 # if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
00038
00039 }
00040
00041 namespace is_incrementable_2
00042 {
00043 is_incrementable_::tag operator++(is_incrementable_::any const&);
00044 is_incrementable_::tag operator++(is_incrementable_::any const&,int);
00045 }
00046 using namespace is_incrementable_2;
00047
00048 namespace is_incrementable_
00049 {
00050
00051 # else
00052
00053 tag operator++(any const&);
00054 tag operator++(any const&,int);
00055
00056 # endif
00057
00058 # if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
00059 || BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
00060 # define BOOST_comma(a,b) (a)
00061 # else
00062
00063 tag operator,(tag,int);
00064 # define BOOST_comma(a,b) (a,b)
00065 # endif
00066
00067
00068 char (& check(tag) )[2];
00069
00070 template <class T>
00071 char check(T const&);
00072
00073
00074 template <class T>
00075 struct impl
00076 {
00077 static typename boost::remove_cv<T>::type& x;
00078
00079 BOOST_STATIC_CONSTANT(
00080 bool
00081 , value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
00082 );
00083 };
00084
00085 template <class T>
00086 struct postfix_impl
00087 {
00088 static typename boost::remove_cv<T>::type& x;
00089
00090 BOOST_STATIC_CONSTANT(
00091 bool
00092 , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
00093 );
00094 };
00095 }
00096
00097 # undef BOOST_comma
00098
00099 template<typename T>
00100 struct is_incrementable
00101 BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
00102 {
00103 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
00104 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
00105 };
00106
00107 template<typename T>
00108 struct is_postfix_incrementable
00109 BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
00110 {
00111 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
00112 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
00113 };
00114
00115 }
00116
00117 BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable)
00118 BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable)
00119
00120 }
00121
00122 # include <boost/type_traits/detail/bool_trait_undef.hpp>
00123
00124 #endif // IS_INCREMENTABLE_DWA200415_HPP