mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-14 04:46:38 +02:00
Adjust directory structure.
This commit is contained in:
48
test/sequence/std_array.cpp
Normal file
48
test/sequence/std_array.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright (C) 2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4180)
|
||||
#endif
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include <boost/fusion/adapted/std_array.hpp>
|
||||
#include <array>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/support/is_view.hpp>
|
||||
#include <boost/fusion/iterator.hpp>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
// See README.md for explanation on qualified names below
|
||||
// C++0x/11 range access interferes with Boost.Fusion interface:
|
||||
// error: call to 'begin' is ambiguous
|
||||
|
||||
using namespace boost::fusion;
|
||||
typedef std::array<int,3> array_type;
|
||||
|
||||
|
||||
BOOST_MPL_ASSERT((traits::is_sequence<array_type>));
|
||||
BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>));
|
||||
|
||||
array_type arr = {{1,2,3}};
|
||||
|
||||
BOOST_TEST(*boost::fusion::begin(arr) == 1);
|
||||
BOOST_TEST(*boost::fusion::next(boost::fusion::begin(arr)) == 2);
|
||||
BOOST_TEST(*advance_c<2>(boost::fusion::begin(arr)) == 3);
|
||||
BOOST_TEST(prior(boost::fusion::next(boost::fusion::begin(arr))) == boost::fusion::begin(arr));
|
||||
BOOST_TEST(*prior(boost::fusion::end(arr)) == 3);
|
||||
BOOST_TEST(at_c<2>(arr) == 3);
|
||||
BOOST_TEST(size(arr) == 3);
|
||||
BOOST_TEST(distance(boost::fusion::begin(arr), boost::fusion::end(arr)) == 3);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user