| [12] | 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.cpp,v $ | 
|---|
 | 11 | // $Date: 2004/09/02 15:41:35 $ | 
|---|
 | 12 | // $Revision: 1.5 $ | 
|---|
 | 13 |  | 
|---|
 | 14 | #include <boost/mpl/count.hpp> | 
|---|
 | 15 |  | 
|---|
 | 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> | 
|---|
 | 20 |  | 
|---|
 | 21 | MPL_TEST_CASE() | 
|---|
 | 22 | { | 
|---|
 | 23 |     typedef vector<int,char,long,short,char,long,double,long> types; | 
|---|
 | 24 |  | 
|---|
 | 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 ); | 
|---|
 | 30 | } | 
|---|
 | 31 |      | 
|---|
 | 32 | MPL_TEST_CASE() | 
|---|
 | 33 | { | 
|---|
 | 34 |     typedef vector_c<int,1,0,5,1,7,5,0,5> values; | 
|---|
 | 35 |  | 
|---|
 | 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 ); | 
|---|
 | 41 | } | 
|---|