mpl_vector.cpp 988 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include <boost/hana/equal.hpp>
  5. #include <boost/hana/front.hpp>
  6. #include <boost/hana/integral_constant.hpp>
  7. #include <boost/hana/type.hpp>
  8. #include <boost/mpl/size.hpp>
  9. #include <boost/mpl/vector.hpp>
  10. namespace hana = boost::hana;
  11. namespace mpl = boost::mpl;
  12. //! [front]
  13. #include <boost/hana/ext/boost/mpl/vector.hpp> // bridge header
  14. using Vector = mpl::vector<int, char, float>;
  15. static_assert(hana::front(Vector{}) == hana::type_c<int>, "");
  16. //! [front]
  17. namespace _ns0 {
  18. //! [size]
  19. using Size = mpl::size<Vector>::type;
  20. static_assert(hana::equal(Size{}, hana::int_c<3>), ""); // breaks!
  21. //! [size]
  22. }
  23. //! [size-fixed]
  24. #include <boost/hana/ext/boost/mpl/integral_c.hpp>
  25. using Size = mpl::size<Vector>::type;
  26. static_assert(hana::equal(Size{}, hana::int_c<3>), "");
  27. //! [size-fixed]
  28. int main() { }