]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/test/sequence/repetitive_view.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / fusion / test / sequence / repetitive_view.cpp
1 /*=============================================================================
2 Copyright (c) 2007 Tobias Schwinger
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 <boost/detail/lightweight_test.hpp>
10 #include <boost/fusion/view/repetitive_view.hpp>
11
12 #include <boost/fusion/container/vector.hpp>
13 #include <boost/fusion/view/joint_view.hpp>
14 #include <boost/fusion/algorithm/transformation/zip.hpp>
15 #include <boost/fusion/algorithm/iteration/for_each.hpp>
16
17 #include <boost/type_traits/is_same.hpp>
18
19 #include <boost/fusion/sequence/intrinsic/begin.hpp>
20 #include <boost/fusion/iterator/next.hpp>
21
22 #include <boost/fusion/functional/generation/make_fused_procedure.hpp>
23
24 struct check_equal
25 {
26 template<typename LHS, typename RHS>
27 void operator()(LHS const& lhs, RHS const& rhs) const
28 {
29 BOOST_TEST(( boost::is_same<LHS,RHS>::value ));
30 BOOST_TEST(( lhs == rhs ));
31 }
32 };
33
34 int main()
35 {
36 using namespace boost::fusion;
37
38 typedef boost::fusion::vector<int,long,float,double> seq_t;
39 seq_t seq(1,2l,3.0f,4.0);
40
41 typedef repetitive_view<seq_t> view_t;
42 view_t view(seq);
43
44 typedef joint_view<seq_t,seq_t> seq_twice_t;
45 typedef joint_view<seq_t,seq_twice_t> seq_repeated_t;
46 seq_twice_t seq_twice(seq,seq);
47 seq_repeated_t seq_repeated(seq,seq_twice);
48
49 for_each(zip(view,seq_repeated), make_fused_procedure(check_equal()));
50
51 return boost::report_errors();
52 }
53