mp_fill.cpp 903 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2015 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/core/lightweight_test_trait.hpp>
  8. #include <boost/mp11/algorithm.hpp>
  9. #include <boost/mp11/list.hpp>
  10. #include <type_traits>
  11. #include <tuple>
  12. #include <utility>
  13. struct X1 {};
  14. int main()
  15. {
  16. using boost::mp11::mp_list;
  17. using boost::mp11::mp_fill;
  18. using L1 = mp_list<int, void(), float[]>;
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fill<L1, X1>, mp_list<X1, X1, X1>>));
  20. //
  21. using L2 = std::tuple<int, char, float>;
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fill<L2, X1>, std::tuple<X1, X1, X1>>));
  23. //
  24. using L3 = std::pair<char, double>;
  25. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_fill<L3, X1>, std::pair<X1, X1>>));
  26. //
  27. return boost::report_errors();
  28. }