1 2 // (C) Copyright Tobias Schwinger 3 // 4 // Use modification and distribution are subject to the boost Software License, 5 // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). 6 7 //------------------------------------------------------------------------------ 8 9 #include <boost/mpl/assert.hpp> 10 #include <boost/mpl/vector.hpp> 11 #include <boost/type_traits/is_same.hpp> 12 13 #include <boost/function_types/function_type.hpp> 14 #include <boost/function_types/function_pointer.hpp> 15 #include <boost/function_types/function_reference.hpp> 16 #include <boost/function_types/member_function_pointer.hpp> 17 18 namespace ft = boost::function_types; 19 namespace mpl = boost::mpl; 20 using boost::is_same; 21 22 class C; 23 typedef int expected_v_1(...); 24 typedef int expected_nv_1(); 25 typedef int (C::*expected_v_2)(...); 26 typedef int (C::*expected_nv_2)(); 27 28 BOOST_MPL_ASSERT(( is_same< 29 ft::function_type<mpl::vector<int>, ft::variadic>::type, expected_v_1 30 > )); 31 32 BOOST_MPL_ASSERT(( is_same< 33 ft::function_type<mpl::vector<int>, ft::non_variadic>::type, expected_nv_1 34 > )); 35 36 BOOST_MPL_ASSERT(( is_same< 37 ft::function_pointer<mpl::vector<int>, ft::variadic>::type, expected_v_1 * 38 > )); 39 40 BOOST_MPL_ASSERT(( is_same< 41 ft::function_pointer<mpl::vector<int>, ft::non_variadic>::type 42 , expected_nv_1 * 43 > )); 44 45 BOOST_MPL_ASSERT(( is_same< 46 ft::function_reference<mpl::vector<int>, ft::variadic>::type, expected_v_1 & 47 > )); 48 49 BOOST_MPL_ASSERT(( is_same< 50 ft::function_reference<mpl::vector<int>, ft::non_variadic>::type 51 , expected_nv_1 & 52 > )); 53 54 BOOST_MPL_ASSERT(( is_same< 55 ft::member_function_pointer<mpl::vector<int,C>, ft::variadic>::type 56 , expected_v_2 57 > )); 58 59 BOOST_MPL_ASSERT(( is_same< 60 ft::member_function_pointer<mpl::vector<int,C>, ft::non_variadic>::type 61 , expected_nv_2 62 > )); 63 64