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 // $Id$
11 // $Date$
12 // $Revision$
13 
14 #include <boost/mpl/find.hpp>
15 #include <boost/mpl/list.hpp>
16 #include <boost/mpl/list_c.hpp>
17 #include <boost/mpl/distance.hpp>
18 #include <boost/mpl/begin_end.hpp>
19 #include <boost/mpl/int.hpp>
20 #include <boost/mpl/aux_/test.hpp>
21 
MPL_TEST_CASE()22 MPL_TEST_CASE()
23 {
24     typedef list<int,char,long,short,char,long,double,long>::type types;
25     typedef list_c<int,1,0,5,1,7,5,0,5> values;
26 
27     typedef find<types, short>::type types_iter;
28     typedef find< values, integral_c<int,7> >::type values_iter;
29 
30     MPL_ASSERT(( is_same< deref<types_iter>::type, short> ));
31     MPL_ASSERT_RELATION( deref<values_iter>::type::value, ==, 7 );
32 
33     typedef begin<types>::type types_first;
34     typedef begin<values>::type values_first;
35     MPL_ASSERT_RELATION( (mpl::distance< types_first,types_iter >::value), ==, 3 );
36     MPL_ASSERT_RELATION( (mpl::distance< values_first,values_iter >::value), ==, 4 );
37 }
38