Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / mpl / test / pair_view.cpp
1
2 // Copyright David Abrahams 2003-2004
3 // Copyright Aleksey Gurtovoy 2004
4 //
5 // Distributed under the Boost Software License, Version 1.0. 
6 // (See accompanying file LICENSE_1_0.txt or copy at 
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/mpl for documentation.
10
11 // $Id$
12 // $Date$
13 // $Revision$
14
15 #include <boost/mpl/pair_view.hpp>
16 #include <boost/mpl/vector/vector50_c.hpp>
17 #include <boost/mpl/range_c.hpp>
18 #include <boost/mpl/distance.hpp>
19 #include <boost/mpl/aux_/test.hpp>
20
21
22 MPL_TEST_CASE()
23 {
24     typedef range_c<int,0,10> r;
25     typedef vector10_c<int,9,8,7,6,5,4,3,2,1,10> v;
26     
27     typedef pair_view<r,v> view;
28     typedef begin<view>::type first_;
29     typedef end<view>::type last_;
30
31     MPL_ASSERT(( is_same< first_::category, mpl::random_access_iterator_tag > ));
32     
33     MPL_ASSERT(( is_same< advance_c<first_,0>::type, first_ > ));
34     MPL_ASSERT(( is_same< advance_c<last_,0>::type, last_ > ));
35     MPL_ASSERT(( is_same< advance_c<first_,10>::type, last_ > ));
36     MPL_ASSERT(( is_same< advance_c<last_,-10>::type, first_ > ));
37     
38     typedef advance_c<first_,5>::type iter;
39     
40     MPL_ASSERT(( is_same< 
41           deref<iter>::type
42         , mpl::pair< integral_c<int,5>,integral_c<int,4> >
43         > )); 
44     
45 }