Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/mpl/test/count_if.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

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/count_if.cpp,v $
11// $Date: 2004/09/02 15:41:35 $
12// $Revision: 1.7 $
13
14#include <boost/mpl/count_if.hpp>
15#include <boost/mpl/vector.hpp>
16#include <boost/mpl/vector_c.hpp>
17#include <boost/mpl/comparison.hpp>
18#include <boost/mpl/int.hpp>
19#include <boost/mpl/aux_/test.hpp>
20
21#include <boost/type_traits/is_float.hpp>
22#include <boost/type_traits/is_same.hpp>
23
24MPL_TEST_CASE()
25{
26    typedef vector<int,char&,long,short,char&,long,double,long> types;
27    typedef vector_c<int,1,0,5,1,7,5,0,5> values;
28   
29    MPL_ASSERT_RELATION( (count_if< types, boost::is_float<_> >::value), ==, 1 );
30    MPL_ASSERT_RELATION( (count_if< types, boost::is_same<_,char&> >::value), ==, 2 );
31    MPL_ASSERT_RELATION( (count_if< types, boost::is_same<_,void*> >::value), ==, 0 );
32
33    MPL_ASSERT_RELATION( (count_if< values, less<_,int_<5> > >::value), ==, 4 );
34    MPL_ASSERT_RELATION( (count_if< values, equal_to<int_<0>,_>  >::value), ==, 2 );
35    MPL_ASSERT_RELATION( (count_if< values, equal_to<int_<-1>,_> >::value), ==, 0 );
36}
Note: See TracBrowser for help on using the repository browser.