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/aux_/test.hpp>
22 typedef single_view<int> view;
23 typedef begin<view>::type first;
24 typedef end<view>::type last;
26 MPL_ASSERT(( is_same< deref<first>::type, int > ));
27 MPL_ASSERT(( is_same< next<first>::type, last > ));
28 MPL_ASSERT(( is_same< prior<last>::type, first > ));
30 MPL_ASSERT(( is_same< mpl::advance<first, int_<0> >::type, first > ));
31 MPL_ASSERT(( is_same< mpl::advance<first, int_<1> >::type, last > ));
32 MPL_ASSERT(( is_same< mpl::advance<last, int_<0> >::type, last > ));
33 MPL_ASSERT(( is_same< mpl::advance<last, int_<-1> >::type, first > ));
35 MPL_ASSERT_RELATION( (mpl::distance<first,first>::value), ==, 0 );
36 MPL_ASSERT_RELATION( (mpl::distance<first,last>::value), ==, 1 );
37 MPL_ASSERT_RELATION( (mpl::distance<last,last>::value), ==, 0 );
39 MPL_ASSERT_RELATION( size<view>::value, ==, 1 );