• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Sergey Nizovtsev 2016
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/core/is_a.hpp>
7 #include <boost/hana/functional/partial.hpp>
8 #include <boost/hana/product.hpp>
9 #include <boost/hana/range.hpp>
10 #include <boost/hana/traits.hpp>
11 #include <boost/hana/transform.hpp>
12 #include <boost/hana/tuple.hpp>
13 #include <boost/hana/type.hpp>
14 
15 namespace hana = boost::hana;
16 
main()17 int main() {
18     constexpr auto type = hana::type_c<int[2][3][4]>;
19 
20     BOOST_HANA_CONSTANT_CHECK(
21         hana::is_an<hana::integral_constant_tag<size_t>>(
22             hana::traits::extent(type, hana::uint_c<1>)
23         )
24     );
25 
26     // Check that we can multiple extents in size_t's ring
27     hana::product<hana::integral_constant_tag<size_t>>(
28         hana::transform(
29             hana::to_tuple(
30                 hana::make_range(
31                     hana::size_c<0>,
32                     hana::traits::rank(type)
33                 )
34             ),
35             hana::partial(hana::traits::extent, type)
36         )
37     );
38 }
39