assign.copy.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/assert.hpp>
  5. #include <boost/hana/tuple.hpp>
  6. #include <string>
  7. namespace hana = boost::hana;
  8. int main() {
  9. {
  10. using T = hana::tuple<>;
  11. T t0;
  12. T t;
  13. t = t0;
  14. }
  15. {
  16. using T = hana::tuple<int>;
  17. T t0(2);
  18. T t;
  19. t = t0;
  20. BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t) == 2);
  21. }
  22. {
  23. using T = hana::tuple<int, char>;
  24. T t0(2, 'a');
  25. T t;
  26. t = t0;
  27. BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t) == 2);
  28. BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t) == 'a');
  29. }
  30. {
  31. using T = hana::tuple<int, char, std::string>;
  32. const T t0(2, 'a', "some text");
  33. T t;
  34. t = t0;
  35. BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t) == 2);
  36. BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t) == 'a');
  37. BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t) == "some text");
  38. }
  39. }