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/distance.cpp,v $ |
---|
11 | // $Date: 2004/09/02 15:41:35 $ |
---|
12 | // $Revision: 1.4 $ |
---|
13 | |
---|
14 | #include <boost/mpl/distance.hpp> |
---|
15 | #include <boost/mpl/list.hpp> |
---|
16 | #include <boost/mpl/range_c.hpp> |
---|
17 | |
---|
18 | #include <boost/mpl/aux_/test.hpp> |
---|
19 | |
---|
20 | |
---|
21 | MPL_TEST_CASE() |
---|
22 | { |
---|
23 | typedef list<char,short,int,long>::type list; |
---|
24 | typedef begin<list>::type first; |
---|
25 | typedef end<list>::type last; |
---|
26 | |
---|
27 | MPL_ASSERT_RELATION( (mpl::distance<first,last>::value), ==, 4 ); |
---|
28 | } |
---|
29 | |
---|
30 | MPL_TEST_CASE() |
---|
31 | { |
---|
32 | typedef range_c<int,0,10>::type range; |
---|
33 | typedef begin<range>::type first; |
---|
34 | typedef end<range>::type last; |
---|
35 | |
---|
36 | MPL_ASSERT_RELATION( (mpl::distance<first,last>::value), ==, 10 ); |
---|
37 | } |
---|