diff --git a/include/boost/function.hpp b/include/boost/function.hpp index ac2b5d9..b9a4665 100644 --- a/include/boost/function.hpp +++ b/include/boost/function.hpp @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -54,7 +56,7 @@ namespace boost { }; template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 0); typedef R result_type; @@ -71,7 +73,7 @@ namespace boost { }; template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 1); typedef R result_type; @@ -88,7 +90,7 @@ namespace boost { }; template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 2); typedef R result_type; @@ -105,7 +107,7 @@ namespace boost { }; template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 3); typedef R result_type; @@ -122,7 +124,7 @@ namespace boost { }; template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 4); typedef R result_type; @@ -140,7 +142,7 @@ namespace boost { template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 5); typedef R result_type; @@ -158,7 +160,7 @@ namespace boost { template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 6); typedef R result_type; @@ -176,7 +178,7 @@ namespace boost { template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 7); typedef R result_type; @@ -194,7 +196,7 @@ namespace boost { template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 8); typedef R result_type; @@ -212,7 +214,7 @@ namespace boost { template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 9); typedef R result_type; @@ -231,7 +233,7 @@ namespace boost { template - struct function_traits + struct function_traits { BOOST_STATIC_CONSTANT(int, arity = 10); typedef R result_type; @@ -531,6 +533,12 @@ namespace boost { }; }; + template + struct is_not_same + { + BOOST_STATIC_CONSTANT(bool, value = !(is_same::value)); + }; + template< typename InR, typename InT1, @@ -550,54 +558,65 @@ namespace boost { class get_function_impl { BOOST_STATIC_CONSTANT(bool, encoded_param = is_function::value); - typedef function_traits traits; + typedef function_traits traits; public: - typedef typename ct_if::value), typename traits::result_type, InR>::type R; - typedef typename ct_if::value), typename traits::arg1_type, InT1>::type T1; - typedef typename ct_if::value), typename traits::arg2_type, InT2>::type T2; - typedef typename ct_if::value), typename traits::arg3_type, InT3>::type T3; - typedef typename ct_if::value), typename traits::arg4_type, InT4>::type T4; - typedef typename ct_if::value), typename traits::arg5_type, InT5>::type T5; - typedef typename ct_if::value), typename traits::arg6_type, InT6>::type T6; - typedef typename ct_if::value), typename traits::arg7_type, InT7>::type T7; - typedef typename ct_if::value), typename traits::arg8_type, InT8>::type T8; - typedef typename ct_if::value), typename traits::arg9_type, InT9>::type T9; - typedef typename ct_if::value), typename traits::arg10_type, InT10>::type T10; - typedef typename ct_if<(encoded_param && - !is_same::value), - InT1, - InPolicy>::type Policy; - typedef typename ct_if<(encoded_param && - !is_same::value), - InT2, - InMixin>::type Mixin; - typedef typename ct_if<(encoded_param && - !is_same::value), - InT3, - InAllocator>::type Allocator; + typedef typename ct_if< + (type_traits::ice_and< + (is_function::value), + (is_not_same::value) + >::value), + InT1, + InPolicy>::type Policy; + + typedef typename ct_if< + (type_traits::ice_and< + (is_function::value), + (is_not_same::value) + >::value), + InT2, + InMixin>::type Mixin; + + typedef typename ct_if< + (type_traits::ice_and< + (is_function::value), + (is_not_same::value) + >::value), + InT3, + InAllocator>::type Allocator; typedef typename real_get_function_impl< (count_used_args::value)