merge new MPL version from 'mplbook' branch

[SVN r24874]
This commit is contained in:
Aleksey Gurtovoy
2004-09-02 15:41:37 +00:00
parent e2e70427cc
commit 1689c8ef83
1216 changed files with 89913 additions and 36752 deletions
+42 -24
View File
@@ -1,33 +1,51 @@
//-----------------------------------------------------------------------------
// boost mpl/test/advance.cpp source file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
// Copyright Aleksey Gurtovoy 2000-2004
//
// Copyright (c) 2000-02
// Aleksey Gurtovoy
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
#include "boost/mpl/vector/vector10_c.hpp"
#include "boost/mpl/advance.hpp"
#include "boost/mpl/begin_end.hpp"
#include "boost/mpl/assert_is_same.hpp"
// $Source$
// $Date$
// $Revision$
namespace mpl = boost::mpl;
#include <boost/mpl/advance.hpp>
#include <boost/mpl/iterator_tags.hpp>
#include <boost/mpl/aux_/test.hpp>
int main()
template< int pos > struct iter
{
typedef mpl::vector10_c<int,0,1,2,3,4,5,6,7,8,9> numbers;
typedef mpl::begin<numbers>::type first;
typedef mpl::end<numbers>::type last;
typedef mpl::bidirectional_iterator_tag category;
typedef iter<(pos + 1)> next;
typedef iter<(pos - 1)> prior;
typedef int_<pos> type;
};
typedef mpl::advance_c<first,10>::type iter1;
typedef mpl::advance_c<last,-10>::type iter2;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
namespace boost { namespace mpl {
template< int pos, typename Default > struct tag< iter<pos>,Default > : void_ {};
}}
#endif
BOOST_MPL_ASSERT_IS_SAME(iter1, last);
BOOST_MPL_ASSERT_IS_SAME(iter2, first);
return 0;
typedef iter<0> first;
typedef iter<10> last;
MPL_TEST_CASE()
{
typedef mpl::advance<first,int_<10> >::type iter1;
typedef advance_c<first,10>::type iter2;
MPL_ASSERT(( is_same<iter1, last> ));
MPL_ASSERT(( is_same<iter2, last> ));
}
MPL_TEST_CASE()
{
typedef mpl::advance<last,int_<-10> >::type iter1;
typedef advance_c<last,-10>::type iter2;
MPL_ASSERT(( is_same<iter1, first> ));
MPL_ASSERT(( is_same<iter2, first> ));
}