github_252.cpp 1.1 KB

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