• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3 
4     Distributed under the Boost Software License, Version 1.0. (See accompanying
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #include <boost/detail/lightweight_test.hpp>
8 #include <boost/fusion/container/vector/vector.hpp>
9 #include <boost/fusion/adapted/mpl.hpp>
10 #include <boost/fusion/sequence/io/out.hpp>
11 #include <boost/fusion/container/generation/make_vector.hpp>
12 #include <boost/fusion/sequence/comparison/equal_to.hpp>
13 #include <boost/fusion/algorithm/transformation/reverse.hpp>
14 #include <boost/mpl/range_c.hpp>
15 
16 int
main()17 main()
18 {
19     using namespace boost::fusion;
20 
21     std::cout << tuple_open('[');
22     std::cout << tuple_close(']');
23     std::cout << tuple_delimiter(", ");
24 
25 /// Testing the reverse_view
26 
27     {
28         typedef boost::mpl::range_c<int, 5, 9> mpl_list1;
29         mpl_list1 sequence;
30 
31         std::cout << reverse(sequence) << std::endl;
32         BOOST_TEST((reverse(sequence) == make_vector(8, 7, 6, 5)));
33     }
34 
35     {
36         char const* s = "Hi Kim";
37         typedef vector<int, char, double, char const*> vector_type;
38         vector_type t(123, 'x', 3.36, s);
39 
40         std::cout << reverse(t) << std::endl;
41         BOOST_TEST((reverse(t) == make_vector(s, 3.36, 'x', 123)));
42         std::cout << reverse(reverse(t)) << std::endl;
43         BOOST_TEST((reverse(reverse(t)) == t));
44     }
45 
46     return boost::report_errors();
47 }
48 
49 
50