std_tuple.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*=============================================================================
  2. Copyright (c) 2014 Kohei Takahashi
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #include <boost/config.hpp>
  7. // adapted/std_tuple.hpp only supports implementations using variadic templates
  8. #if defined(BOOST_NO_CXX11_HDR_TUPLE) || \
  9. defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  10. # error "does not meet requirements"
  11. #endif
  12. #include <boost/detail/lightweight_test.hpp>
  13. #include <boost/fusion/adapted/std_tuple.hpp>
  14. #include <boost/fusion/sequence/convert.hpp>
  15. #include <boost/fusion/container/vector/vector.hpp>
  16. #include <boost/fusion/container/generation/make_vector.hpp>
  17. #include <tuple>
  18. #include <string>
  19. int main()
  20. {
  21. using namespace boost::fusion;
  22. using namespace boost;
  23. {
  24. // conversion vector to std tuple
  25. std::tuple<int, std::string> t = convert<std_tuple_tag>(make_vector(123, std::string("Hola!!!")));
  26. BOOST_TEST(std::get<0>(t) == 123);
  27. BOOST_TEST(std::get<1>(t) == "Hola!!!");
  28. }
  29. return boost::report_errors();
  30. }