1 /*=============================================================================
2 Copyright (c) 2003 Joel de Guzman
4 Use, modification and distribution is 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 #include <boost/detail/lightweight_test.hpp>
9 #include <boost/spirit/fusion/sequence/tuple.hpp>
10 #include <boost/spirit/fusion/sequence/io.hpp>
11 #include <boost/spirit/fusion/sequence/make_tuple.hpp>
12 #include <boost/spirit/fusion/sequence/equal_to.hpp>
13 #include <boost/spirit/fusion/algorithm/remove_if.hpp>
14 #include <boost/type_traits/is_class.hpp>
15 #include <boost/type_traits/is_same.hpp>
16 #include <boost/mpl/not.hpp>
17 #include <boost/mpl/vector.hpp>
21 operator char const*() const
29 operator char const*() const
38 using namespace boost::fusion
;
39 using boost::mpl::vector
;
41 using boost::mpl::not_
;
42 using boost::is_class
;
45 std::cout
<< tuple_open('[');
46 std::cout
<< tuple_close(']');
47 std::cout
<< tuple_delimiter(", ");
52 typedef tuple
<Y
, char, long, X
, bool, double> tuple_type
;
53 tuple_type
t(y
, '@', 987654, x
, true, 6.6);
56 std::cout
<< remove_if(t
, not_
<is_class
<_
> >()) << std::endl
;
57 BOOST_TEST((remove_if(t
, not_
<is_class
<_
> >())
58 == make_tuple(y
, x
)));
62 std::cout
<< remove_if(t
, is_class
<_
>()) << std::endl
;
63 BOOST_TEST((remove_if(t
, is_class
<_
>())
64 == make_tuple('@', 987654, true, 6.6)));
68 typedef vector
<Y
, char, long, X
, bool, double> mpl_vec
;
69 BOOST_TEST((remove_if(mpl_vec(), not_
<is_class
<_
> >())
71 BOOST_TEST((remove_if(mpl_vec(), is_class
<_
>())
72 == tuple
<char, long, bool, double>()));
75 return boost::report_errors();