File indexing completed on 2025-01-18 09:39:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_LAMBDA_ARITY_CODE_HPP
0014 #define BOOST_LAMBDA_ARITY_CODE_HPP
0015
0016 #include "boost/type_traits/cv_traits.hpp"
0017 #include "boost/type_traits/transform_traits.hpp"
0018
0019 namespace boost {
0020 namespace lambda {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 enum { NONE = 0x00,
0031 FIRST = 0x01,
0032 SECOND = 0x02,
0033 THIRD = 0x04,
0034 EXCEPTION = 0x08,
0035 RETHROW = 0x10};
0036
0037
0038 template<class T>
0039 struct get_tuple_arity;
0040
0041 namespace detail {
0042
0043 template <class T> struct get_arity_;
0044
0045 }
0046
0047 template <class T> struct get_arity {
0048
0049 BOOST_STATIC_CONSTANT(int, value = detail::get_arity_<typename boost::remove_cv<typename boost::remove_reference<T>::type>::type>::value);
0050
0051 };
0052
0053 namespace detail {
0054
0055 template<class T>
0056 struct get_arity_ {
0057 BOOST_STATIC_CONSTANT(int, value = 0);
0058 };
0059
0060 template<class T>
0061 struct get_arity_<lambda_functor<T> > {
0062 BOOST_STATIC_CONSTANT(int, value = get_arity<T>::value);
0063 };
0064
0065 template<class Action, class Args>
0066 struct get_arity_<lambda_functor_base<Action, Args> > {
0067 BOOST_STATIC_CONSTANT(int, value = get_tuple_arity<Args>::value);
0068 };
0069
0070 template<int I>
0071 struct get_arity_<placeholder<I> > {
0072 BOOST_STATIC_CONSTANT(int, value = I);
0073 };
0074
0075 }
0076
0077 template<class T>
0078 struct get_tuple_arity {
0079 BOOST_STATIC_CONSTANT(int, value = get_arity<typename T::head_type>::value | get_tuple_arity<typename T::tail_type>::value);
0080 };
0081
0082
0083 template<>
0084 struct get_tuple_arity<null_type> {
0085 BOOST_STATIC_CONSTANT(int, value = 0);
0086 };
0087
0088
0089
0090
0091 template<class T, int I>
0092 struct has_placeholder {
0093 BOOST_STATIC_CONSTANT(bool, value = (get_arity<T>::value & I) != 0);
0094 };
0095
0096 template<int I, int J>
0097 struct includes_placeholder {
0098 BOOST_STATIC_CONSTANT(bool, value = (J & I) != 0);
0099 };
0100
0101 template<int I, int J>
0102 struct lacks_placeholder {
0103 BOOST_STATIC_CONSTANT(bool, value = ((J & I) == 0));
0104 };
0105
0106
0107 }
0108 }
0109
0110 #endif