1 | |
---|
2 | // Copyright Eric Friedman 2003 |
---|
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/index_of.cpp,v $ |
---|
11 | // $Date: 2004/09/02 15:41:35 $ |
---|
12 | // $Revision: 1.4 $ |
---|
13 | |
---|
14 | |
---|
15 | #include <boost/mpl/index_of.hpp> |
---|
16 | #include <boost/mpl/list.hpp> |
---|
17 | #include <boost/mpl/void.hpp> |
---|
18 | #include <boost/mpl/aux_/test.hpp> |
---|
19 | |
---|
20 | MPL_TEST_CASE() |
---|
21 | { |
---|
22 | typedef list< int, double, float >::type types; |
---|
23 | |
---|
24 | typedef index_of< types, int >::type index_of_int; |
---|
25 | typedef index_of< types, double >::type index_of_double; |
---|
26 | typedef index_of< types, float >::type index_of_float; |
---|
27 | typedef index_of< types, char >::type index_of_char; |
---|
28 | |
---|
29 | MPL_ASSERT_RELATION( index_of_int::value, ==, 0 ); |
---|
30 | MPL_ASSERT_RELATION( index_of_double::value, ==, 1 ); |
---|
31 | MPL_ASSERT_RELATION( index_of_float::value, ==, 2 ); |
---|
32 | |
---|
33 | MPL_ASSERT(( is_void_< index_of_char > )); |
---|
34 | } |
---|