File indexing completed on 2025-01-18 09:30:42
0001
0002
0003
0004 #ifndef IS_INCREMENTABLE_DWA200415_HPP
0005 # define IS_INCREMENTABLE_DWA200415_HPP
0006
0007 # include <boost/type_traits/integral_constant.hpp>
0008 # include <boost/type_traits/remove_cv.hpp>
0009 # include <boost/detail/workaround.hpp>
0010
0011 namespace boost { namespace detail {
0012
0013
0014
0015
0016
0017
0018
0019
0020 namespace is_incrementable_
0021 {
0022
0023
0024 struct tag {};
0025
0026
0027
0028
0029 struct any { template <class T> any(T const&); };
0030
0031
0032 # if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
0033
0034 }
0035
0036 namespace is_incrementable_2
0037 {
0038 is_incrementable_::tag operator++(is_incrementable_::any const&);
0039 is_incrementable_::tag operator++(is_incrementable_::any const&,int);
0040 }
0041 using namespace is_incrementable_2;
0042
0043 namespace is_incrementable_
0044 {
0045
0046 # else
0047
0048 tag operator++(any const&);
0049 tag operator++(any const&,int);
0050
0051 # endif
0052
0053 # if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
0054 # define BOOST_comma(a,b) (a)
0055 # else
0056
0057 tag operator,(tag,int);
0058 # define BOOST_comma(a,b) (a,b)
0059 # endif
0060
0061 # if defined(BOOST_MSVC)
0062 # pragma warning(push)
0063 # pragma warning(disable:4913)
0064 # endif
0065
0066
0067 char (& check_(tag) )[2];
0068
0069 template <class T>
0070 char check_(T const&);
0071
0072
0073 template <class T>
0074 struct impl
0075 {
0076 static typename boost::remove_cv<T>::type& x;
0077
0078 BOOST_STATIC_CONSTANT(
0079 bool
0080 , value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1
0081 );
0082 };
0083
0084 template <class T>
0085 struct postfix_impl
0086 {
0087 static typename boost::remove_cv<T>::type& x;
0088
0089 BOOST_STATIC_CONSTANT(
0090 bool
0091 , value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1
0092 );
0093 };
0094
0095 # if defined(BOOST_MSVC)
0096 # pragma warning(pop)
0097 # endif
0098
0099 }
0100
0101 # undef BOOST_comma
0102
0103 template<typename T>
0104 struct is_incrementable :
0105 public boost::integral_constant<bool, boost::detail::is_incrementable_::impl<T>::value>
0106 {
0107 };
0108
0109 template<typename T>
0110 struct is_postfix_incrementable :
0111 public boost::integral_constant<bool, boost::detail::is_incrementable_::postfix_impl<T>::value>
0112 {
0113 };
0114
0115 }
0116
0117 }
0118
0119 # include <boost/type_traits/detail/bool_trait_undef.hpp>
0120
0121 #endif