/*============================================================================= Copyright (c) 2007 Tobias Schwinger Use modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). ==============================================================================*/ #include #include #include #include #include #include #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL #include #endif using boost::is_same; using boost::reference_wrapper; using boost::fusion::traits::deduce; using boost::fusion::traits::deduce_sequence; namespace fusion = boost::fusion; template struct test_seq_ctor { typename deduce_sequence::type fsq_args; test_seq_ctor(Args const & args) : fsq_args(args) { } }; #define TEST_SAME_TYPE(a,b) BOOST_TEST(( is_same< a, b >::value )) #define TEST_SAME_ELEMENTS(a,b) BOOST_TEST(( boost::mpl::equal< a, b >::type::value )) typedef fusion::vector args1; typedef fusion::vector storable1; template struct test_seq_ctor; typedef fusion::vector< reference_wrapper &, reference_wrapper &, reference_wrapper const &, reference_wrapper const & > args2; typedef fusion::vector storable2; template struct test_seq_ctor; typedef fusion::vector args3; typedef fusion::vector storable3; template struct test_seq_ctor; typedef fusion::vector args4; typedef args4 storable4; template struct test_seq_ctor; int main() { TEST_SAME_TYPE(deduce::type, int &); TEST_SAME_TYPE(deduce::type, int volatile &); TEST_SAME_TYPE(deduce::type, int); TEST_SAME_TYPE(deduce::type, int); TEST_SAME_TYPE(deduce::type, int); TEST_SAME_TYPE(deduce< reference_wrapper & >::type, int &); TEST_SAME_TYPE(deduce< reference_wrapper & >::type, int const &); TEST_SAME_TYPE(deduce< reference_wrapper const & >::type, int &); TEST_SAME_TYPE(deduce< reference_wrapper const & >::type, int const &); #ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL TEST_SAME_TYPE(deduce< std::reference_wrapper & >::type, int &); TEST_SAME_TYPE(deduce< std::reference_wrapper & >::type, int const &); TEST_SAME_TYPE(deduce< std::reference_wrapper const & >::type, int &); TEST_SAME_TYPE(deduce< std::reference_wrapper const & >::type, int const &); #endif TEST_SAME_TYPE(deduce< int(&)[2] >::type, int(&)[2]); TEST_SAME_TYPE(deduce< int const (&)[2] >::type, int const (&)[2]); TEST_SAME_TYPE(deduce< int volatile (&)[2] >::type, int volatile (&)[2]); TEST_SAME_TYPE(deduce< int const volatile (&)[2] >::type, int const volatile (&)[2]); TEST_SAME_ELEMENTS(deduce_sequence::type,storable1); TEST_SAME_ELEMENTS(deduce_sequence::type,storable2); TEST_SAME_ELEMENTS(deduce_sequence::type,storable3); TEST_SAME_ELEMENTS(deduce_sequence::type,storable4); return boost::report_errors(); }