]>
Commit | Line | Data |
---|---|---|
1 | // Copyright Louis Dionne 2013-2017 | |
2 | // Distributed under the Boost Software License, Version 1.0. | |
3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | #include <boost/hana/assert.hpp> | |
6 | #include <boost/hana/experimental/view.hpp> | |
7 | #include <boost/hana/is_empty.hpp> | |
8 | #include <boost/hana/not.hpp> | |
9 | #include <boost/hana/tuple.hpp> | |
10 | ||
11 | #include <support/seq.hpp> | |
12 | namespace hana = boost::hana; | |
13 | ||
14 | ||
15 | template <int> struct undefined { }; | |
16 | ||
17 | int main() { | |
18 | auto container = ::seq; | |
19 | ||
20 | { | |
21 | auto storage = container(); | |
22 | auto sliced = hana::experimental::sliced(storage, hana::tuple_c<int>); | |
23 | BOOST_HANA_CONSTANT_CHECK(hana::is_empty(sliced)); | |
24 | }{ | |
25 | auto storage = container(undefined<0>{}); | |
26 | auto sliced = hana::experimental::sliced(storage, hana::tuple_c<int>); | |
27 | BOOST_HANA_CONSTANT_CHECK(hana::is_empty(sliced)); | |
28 | }{ | |
29 | auto storage = container(undefined<0>{}, undefined<1>{}); | |
30 | auto sliced = hana::experimental::sliced(storage, hana::tuple_c<int>); | |
31 | BOOST_HANA_CONSTANT_CHECK(hana::is_empty(sliced)); | |
32 | } | |
33 | ||
34 | { | |
35 | auto storage = container(undefined<0>{}); | |
36 | auto sliced = hana::experimental::sliced(storage, hana::tuple_c<int, 0>); | |
37 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(sliced))); | |
38 | }{ | |
39 | auto storage = container(undefined<0>{}); | |
40 | auto sliced = hana::experimental::sliced(storage, hana::tuple_c<int, 0, 0>); | |
41 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(sliced))); | |
42 | } | |
43 | ||
44 | { | |
45 | auto storage = container(undefined<0>{}, undefined<1>{}); | |
46 | auto sliced = hana::experimental::sliced(storage, hana::tuple_c<int, 0, 1>); | |
47 | BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(sliced))); | |
48 | } | |
49 | } |