/*============================================================================= 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 #include #include #include #include #include #include #include #include #include #include #include #include int main() { using namespace boost::fusion; { typedef vector2 int_vector; typedef vector2 char_vector; typedef vector seqs_type; typedef zip_view view; BOOST_MPL_ASSERT((boost::mpl::equal_to::type, boost::fusion::result_of::size::type>)); BOOST_STATIC_ASSERT((boost::fusion::result_of::size::value == 2)); int_vector iv(1,2); char_vector cv('a', 'b'); seqs_type seqs(iv, cv); view v(seqs); BOOST_TEST(at_c<0>(v) == make_vector(1, 'a')); BOOST_TEST(at_c<1>(v) == make_vector(2, 'b')); BOOST_TEST(front(v) == make_vector(1, 'a')); BOOST_TEST(back(v) == make_vector(2, 'b')); BOOST_TEST(*next(begin(v)) == make_vector(2, 'b')); BOOST_TEST(*prior(end(v)) == make_vector(2, 'b')); BOOST_TEST(advance_c<2>(begin(v)) == end(v)); BOOST_TEST(advance_c<-2>(end(v)) == begin(v)); BOOST_TEST(distance(begin(v), end(v)) == 2); BOOST_STATIC_ASSERT((boost::fusion::result_of::distance::type, boost::fusion::result_of::end::type>::value == 2)); BOOST_MPL_ASSERT((boost::is_same::type, vector2 >)); BOOST_MPL_ASSERT((boost::is_same::type>::type, vector2 >)); } { using namespace boost; typedef mpl::vector2 v1_type; typedef mpl::vector2 v2_type; typedef fusion::vector seqs_type; typedef fusion::zip_view view; v1_type v1; v2_type v2; seqs_type seqs(v1,v2); view v(seqs); BOOST_TEST((fusion::at_c<0>(v) == mpl::vector2())); BOOST_TEST((fusion::at_c<1>(v) == mpl::vector2())); BOOST_TEST((fusion::front(v) == mpl::vector2())); BOOST_TEST((fusion::back(v) == mpl::vector2())); BOOST_TEST((*fusion::next(fusion::begin(v)) == mpl::vector2())); BOOST_TEST((*fusion::prior(fusion::end(v)) == mpl::vector2())); BOOST_TEST(fusion::advance_c<2>(fusion::begin(v)) == fusion::end(v)); BOOST_TEST(fusion::advance_c<-2>(fusion::end(v)) == fusion::begin(v)); BOOST_TEST(fusion::distance(fusion::begin(v), fusion::end(v)) == 2); } return boost::report_errors(); }