Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/test/erase.cpp @ 28

Last change on this file since 28 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.3 KB
Line 
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
23MPL_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
35MPL_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}
Note: See TracBrowser for help on using the repository browser.