/*============================================================================= Copyright (c) 1999-2003 Jaakko Jarvi Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2006 Dan Marsden 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) ==============================================================================*/ #include #include #include #include #include #include #include #include #include #include int main() { using namespace boost::fusion; { typedef deque<> initial_deque_type; initial_deque_type initial_deque; typedef back_extended_deque extended_type; extended_type extended(initial_deque, 101L); BOOST_TEST(size(extended) == 1); BOOST_TEST(extended == make_vector(101L)); BOOST_TEST(*begin(extended) == 101L); BOOST_TEST(*prior(end(extended)) == 101L); BOOST_TEST(distance(begin(extended), end(extended)) == 1); } { namespace mpl = boost::mpl; typedef deque<> initial_deque_type; typedef back_extended_deque extended_type; BOOST_MPL_ASSERT((boost::is_same::type, long>)); BOOST_MPL_ASSERT((boost::is_same::type>::type, long>)); BOOST_MPL_ASSERT((mpl::equal_to::type, mpl::int_<1> >)); } { long l(101L); typedef deque<> initial_deque_type; initial_deque_type initial_deque; typedef back_extended_deque extended_type; extended_type extended(initial_deque, l); BOOST_TEST(extended == make_vector(101L)); long l2(202L); extended_type extended2(initial_deque_type(), l2); extended = extended2; BOOST_TEST(extended == make_vector(202L)); BOOST_TEST(l == l2); } { typedef deque initial_deque_type; initial_deque_type initial_deque(1, 'a'); typedef back_extended_deque extended_type; extended_type extended(initial_deque, 101L); BOOST_TEST(size(extended) == 3); BOOST_TEST(extended == make_vector(1, 'a', 101L)); BOOST_TEST(*begin(extended) == 1); BOOST_TEST(*next(begin(extended)) == 'a'); BOOST_TEST(*prior(end(extended)) == 101L); BOOST_TEST(distance(begin(extended), end(extended)) == 3); BOOST_TEST(*advance_c<2>(begin(extended)) == 101L); } { namespace mpl = boost::mpl; typedef deque initial_deque_type; typedef back_extended_deque extended_type; BOOST_MPL_ASSERT((boost::is_same::type, int>)); BOOST_MPL_ASSERT((boost::is_same::type, char>)); BOOST_MPL_ASSERT((boost::is_same::type, long>)); BOOST_MPL_ASSERT((boost::is_same::type>::type, int>)); BOOST_MPL_ASSERT((mpl::equal_to::type, mpl::int_<3> >)); } { char ch('a'); long l(101L); int i(1); typedef deque initial_deque_type; initial_deque_type initial_deque(i, ch); typedef back_extended_deque extended_type; extended_type extended(initial_deque, l); BOOST_TEST(extended == make_vector(1, 'a', 101L)); char ch2('b'); long l2(202L); int i2(2); extended_type extended2(initial_deque_type(i2, ch2), l2); extended = extended2; BOOST_TEST(extended == make_vector(2, 'b', 202L)); BOOST_TEST(i == i2); BOOST_TEST(ch == ch2); BOOST_TEST(l == l2); } return boost::report_errors(); }