]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/test/single_view.cpp
2 // Copyright Aleksey Gurtovoy 2001-2004
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)
8 // See http://www.boost.org/libs/mpl for documentation.
14 #include <boost/mpl/single_view.hpp>
15 #include <boost/mpl/advance.hpp>
16 #include <boost/mpl/size.hpp>
17 #include <boost/mpl/begin_end.hpp>
18 #include <boost/mpl/equal.hpp>
19 #include <boost/mpl/aux_/test.hpp>
23 typedef single_view
<int> view
;
24 typedef begin
<view
>::type first
;
25 typedef end
<view
>::type last
;
27 MPL_ASSERT(( is_same
< deref
<first
>::type
, int > ));
28 MPL_ASSERT(( is_same
< next
<first
>::type
, last
> ));
29 MPL_ASSERT(( is_same
< prior
<last
>::type
, first
> ));
31 MPL_ASSERT(( is_same
< mpl::advance
<first
, int_
<0> >::type
, first
> ));
32 MPL_ASSERT(( is_same
< mpl::advance
<first
, int_
<1> >::type
, last
> ));
33 MPL_ASSERT(( is_same
< mpl::advance
<last
, int_
<0> >::type
, last
> ));
34 MPL_ASSERT(( is_same
< mpl::advance
<last
, int_
<-1> >::type
, first
> ));
36 MPL_ASSERT_RELATION( (mpl::distance
<first
,first
>::value
), ==, 0 );
37 MPL_ASSERT_RELATION( (mpl::distance
<first
,last
>::value
), ==, 1 );
38 MPL_ASSERT_RELATION( (mpl::distance
<last
,last
>::value
), ==, 0 );
40 MPL_ASSERT_RELATION( size
<view
>::value
, ==, 1 );
42 MPL_ASSERT(( equal
< view
, view::type
> ));