1 | |
---|
2 | // Copyright Aleksey Gurtovoy 2000-2004 |
---|
3 | // |
---|
4 | // Distributed under the Boost Software License,Version 1.0. |
---|
5 | // (See accompanying file LICENSE_1_0.txt or copy at |
---|
6 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
7 | // |
---|
8 | // See http://www.boost.org/libs/mpl for documentation. |
---|
9 | |
---|
10 | // $Source: /cvsroot/boost/boost/libs/mpl/test/erase.cpp,v $ |
---|
11 | // $Date: 2004/09/02 15:41:35 $ |
---|
12 | // $Revision: 1.4 $ |
---|
13 | |
---|
14 | #include <boost/mpl/erase.hpp> |
---|
15 | #include <boost/mpl/list.hpp> |
---|
16 | #include <boost/mpl/list_c.hpp> |
---|
17 | #include <boost/mpl/find.hpp> |
---|
18 | #include <boost/mpl/size.hpp> |
---|
19 | #include <boost/mpl/integral_c.hpp> |
---|
20 | #include <boost/mpl/begin_end.hpp> |
---|
21 | #include <boost/mpl/aux_/test.hpp> |
---|
22 | |
---|
23 | MPL_TEST_CASE() |
---|
24 | { |
---|
25 | typedef list<int,char,long,short,char,long,double,long> types; |
---|
26 | typedef find<types,short>::type iter; |
---|
27 | |
---|
28 | typedef erase<types, iter>::type result; |
---|
29 | MPL_ASSERT_RELATION( size<result>::value, ==, 7 ); |
---|
30 | |
---|
31 | typedef find<result,short>::type result_iter; |
---|
32 | MPL_ASSERT(( is_same< result_iter, end<result>::type > )); |
---|
33 | } |
---|
34 | |
---|
35 | MPL_TEST_CASE() |
---|
36 | { |
---|
37 | typedef list_c<int,1,0,5,1,7,5,0,5> values; |
---|
38 | typedef find< values, integral_c<int,7> >::type iter; |
---|
39 | |
---|
40 | typedef erase<values, iter>::type result; |
---|
41 | MPL_ASSERT_RELATION( size<result>::value, ==, 7 ); |
---|
42 | |
---|
43 | typedef find<result, integral_c<int,7> >::type result_iter; |
---|
44 | MPL_ASSERT(( is_same< result_iter, end<result>::type > )); |
---|
45 | } |
---|