Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/mpl/test/pair_view.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.3 KB
Line 
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// $Source: /cvsroot/boost/boost/libs/mpl/test/pair_view.cpp,v $
12// $Date: 2004/11/28 03:35:12 $
13// $Revision: 1.3 $
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
22MPL_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}
Note: See TracBrowser for help on using the repository browser.