123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- // (C) Copyright Tobias Schwinger
- //
- // Use modification and distribution are subject to the boost Software License,
- // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
- //------------------------------------------------------------------------------
- #include <boost/mpl/assert.hpp>
- #include <boost/type_traits/is_same.hpp>
- #include <boost/function_types/function_type.hpp>
- namespace ft = boost::function_types;
- namespace mpl = boost::mpl;
- template<typename C, typename T>
- void test_non_cv(T C::*)
- {
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_const >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::volatile_qualified> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT((
- boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
- , T
- >));
- }
- template<typename C, typename T>
- void test_c_non_v(T C::*)
- {
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_const >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int> >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::volatile_qualified> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT((
- boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
- , T
- >));
- }
- template<typename C, typename T>
- void test_v_non_c(T C::*)
- {
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_const >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::volatile_qualified> >::type
- , T
- >));
- BOOST_MPL_ASSERT((
- boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
- , T
- >));
- }
- template<typename C, typename T>
- void test_cv(T C::*)
- {
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_const >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::non_volatile >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::non_volatile> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::const_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::non_const,ft::volatile_qualified> >::type
- , T
- >));
- BOOST_MPL_ASSERT_NOT((
- boost::is_same<
- ft::function_type< mpl::vector<void,int>, ft::volatile_qualified >::type
- , T
- >));
- BOOST_MPL_ASSERT(( boost::is_same<
- ft::function_type< mpl::vector<void,int>,
- ft::tag<ft::const_qualified,ft::volatile_qualified> >::type
- , T
- >));
- }
- struct C
- {
- void non_cv(int) { }
- void c_non_v(int) const { }
- void v_non_c(int) volatile { }
- void cv(int) const volatile { }
- };
- void instanitate()
- {
- test_non_cv(& C::non_cv);
- test_c_non_v(& C::c_non_v);
- test_v_non_c(& C::v_non_c);
- test_cv(& C::cv);
- }
|