]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/count.cpp
2 // Copyright Aleksey Gurtovoy 2000-2004
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)
8 // See http://www.boost.org/libs/mpl for documentation.
14 #include <boost/mpl/count.hpp>
16 #include <boost/mpl/vector.hpp>
17 #include <boost/mpl/vector_c.hpp>
18 #include <boost/mpl/integral_c.hpp>
19 #include <boost/mpl/aux_/test.hpp>
23 typedef vector
<int,char,long,short,char,long,double,long> types
;
25 MPL_ASSERT_RELATION( (count
<types
,int>::value
), ==, 1 );
26 MPL_ASSERT_RELATION( (count
<types
,double>::value
), ==, 1 );
27 MPL_ASSERT_RELATION( (count
<types
,char>::value
), ==, 2 );
28 MPL_ASSERT_RELATION( (count
<types
,long>::value
), ==, 3 );
29 MPL_ASSERT_RELATION( (count
<types
,unsigned>::value
), ==, 0 );
34 typedef vector_c
<int,1,0,5,1,7,5,0,5> values
;
36 MPL_ASSERT_RELATION( (count
< values
, integral_c
<int,1> >::value
), ==, 2 );
37 MPL_ASSERT_RELATION( (count
< values
, integral_c
<int,0> >::value
), ==, 2 );
38 MPL_ASSERT_RELATION( (count
< values
, integral_c
<int,5> >::value
), ==, 3 );
39 MPL_ASSERT_RELATION( (count
< values
, integral_c
<int,7> >::value
), ==, 1 );
40 MPL_ASSERT_RELATION( (count
< values
, integral_c
<int,8> >::value
), ==, 0 );