]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // |
2 | // Copyright (C) 2013 Mateusz Loskot <mateusz@loskot.net> | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // (See accompanying file LICENSE_1_0.txt or copy | |
6 | // at http://www.boost.org/LICENSE_1_0.txt) | |
7 | // | |
8 | #include <boost/config.hpp> | |
b32b8144 | 9 | |
7c673cae | 10 | #ifdef BOOST_NO_CXX11_HDR_ARRAY |
b32b8144 FG |
11 | # error "does not meet requirements" |
12 | #endif | |
7c673cae FG |
13 | |
14 | #ifdef BOOST_MSVC | |
15 | #pragma warning(disable:4180) | |
16 | #endif | |
17 | #include <boost/detail/lightweight_test.hpp> | |
18 | ||
19 | #include <boost/fusion/adapted/std_array.hpp> | |
20 | #include <array> | |
21 | ||
22 | #include <boost/fusion/sequence/intrinsic.hpp> | |
23 | #include <boost/fusion/support/is_sequence.hpp> | |
24 | #include <boost/fusion/support/is_view.hpp> | |
25 | #include <boost/fusion/iterator.hpp> | |
26 | ||
27 | #include <boost/mpl/assert.hpp> | |
28 | ||
29 | int main() | |
30 | { | |
31 | using namespace boost::fusion; | |
32 | typedef std::array<int,3> array_type; | |
33 | ||
34 | BOOST_MPL_ASSERT((traits::is_sequence<array_type>)); | |
35 | BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>)); | |
36 | ||
37 | array_type arr = {{1,2,3}}; | |
38 | ||
39 | BOOST_TEST(*boost::fusion::begin(arr) == 1); | |
40 | BOOST_TEST(*boost::fusion::next(boost::fusion::begin(arr)) == 2); | |
41 | BOOST_TEST(*advance_c<2>(boost::fusion::begin(arr)) == 3); | |
42 | BOOST_TEST(prior(boost::fusion::next(boost::fusion::begin(arr))) == boost::fusion::begin(arr)); | |
43 | BOOST_TEST(*prior(boost::fusion::end(arr)) == 3); | |
44 | BOOST_TEST(at_c<2>(arr) == 3); | |
45 | BOOST_TEST(boost::fusion::size(arr) == 3); | |
46 | BOOST_TEST(distance(boost::fusion::begin(arr), boost::fusion::end(arr)) == 3); | |
47 | ||
48 | return boost::report_errors(); | |
49 | } |