• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2015 Kohei Takahashi
3 
4     Use modification and distribution are subject to the Boost Software
5     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6     http://www.boost.org/LICENSE_1_0.txt).
7 ==============================================================================*/
8 
9 #include <string>
10 #include <boost/config.hpp>
11 #include <boost/core/lightweight_test.hpp>
12 #include <boost/fusion/include/convert.hpp>
13 #include <boost/fusion/include/at.hpp>
14 
15 #include <boost/fusion/include/vector.hpp>
16 #include <boost/fusion/include/deque.hpp>
17 #include <boost/fusion/include/list.hpp>
18 #include <boost/fusion/include/boost_tuple.hpp>
19 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
20 #include <boost/fusion/include/std_tuple.hpp>
21 #endif
22 
23 template <typename Tag>
test(FUSION_SEQUENCE<int,std::string> const & seq)24 void test(FUSION_SEQUENCE<int, std::string> const& seq)
25 {
26     typedef typename
27         boost::fusion::result_of::convert<
28             Tag
29           , FUSION_SEQUENCE<int, std::string>
30         >::type
31     type;
32 
33     type v = boost::fusion::convert<Tag>(seq);
34     BOOST_TEST((boost::fusion::at_c<0>(v) == 123));
35     BOOST_TEST((boost::fusion::at_c<1>(v) == "Hola!!!"));
36 }
37 
main()38 int main()
39 {
40     FUSION_SEQUENCE<int, std::string> seq(123, "Hola!!!");
41     test<boost::fusion::vector_tag>(seq);
42     test<boost::fusion::deque_tag>(seq);
43     test<boost::fusion::cons_tag>(seq);
44     test<boost::fusion::boost_tuple_tag>(seq);
45 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
46     test<boost::fusion::std_tuple_tag>(seq);
47 #endif
48 
49     return boost::report_errors();
50 }
51 
52