]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/fusion/test/algorithm/remove.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / fusion / test / algorithm / remove.cpp
CommitLineData
7c673cae
FG
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/remove.hpp>
14#include <boost/mpl/vector.hpp>
15
16struct X
17{
18 operator char const*() const
19 {
20 return "<X-object>";
21 }
22};
23
24struct Y
25{
26 operator char const*() const
27 {
28 return "<Y-object>";
29 }
30};
31
32int
33main()
34{
35 using namespace boost::fusion;
36 using boost::mpl::identity;
37 using boost::mpl::vector;
38 namespace fusion = boost::fusion;
39
40 std::cout << tuple_open('[');
41 std::cout << tuple_close(']');
42 std::cout << tuple_delimiter(", ");
43
44/// Testing remove
45
46 X x; Y y;
47 typedef fusion::vector<Y, char, long, X, bool, double> vector_type;
48 vector_type t(y, '@', 987654, x, true, 6.6);
49
50 {
51 std::cout << fusion::remove<X>(t) << std::endl;
52 BOOST_TEST((fusion::remove<X>(t)
53 == make_vector(y, '@', 987654, true, 6.6)));
54 }
55
56 {
57 std::cout << fusion::remove<Y>(t) << std::endl;
58 BOOST_TEST((fusion::remove<Y>(t)
59 == make_vector('@', 987654, x, true, 6.6)));
60 }
61
62 {
63 std::cout << fusion::remove<long>(t) << std::endl;
64 BOOST_TEST((fusion::remove<long>(t)
65 == make_vector(y, '@', x, true, 6.6)));
66 }
67
68 {
69 typedef vector<Y, char, long, X, bool> mpl_vec;
70 BOOST_TEST((fusion::remove<X>(mpl_vec())
71 == vector<Y, char, long, bool>()));
72 BOOST_TEST((fusion::remove<Y>(mpl_vec())
73 == vector<char, long, X, bool>()));
74 BOOST_TEST((fusion::remove<long>(mpl_vec())
75 == vector<Y, char, X, bool>()));
76 }
77
78 return boost::report_errors();
79}
80