forked from boostorg/fusion
Add test for convert seq to std::tuple
Signed-off-by: Kohei Takahashi <flast@flast.jp>
This commit is contained in:
@ -150,6 +150,7 @@ project
|
|||||||
[ run sequence/define_tpl_struct.cpp : : : : ]
|
[ run sequence/define_tpl_struct.cpp : : : : ]
|
||||||
[ run sequence/define_tpl_struct_inline.cpp : : : : ]
|
[ run sequence/define_tpl_struct_inline.cpp : : : : ]
|
||||||
[ run sequence/define_assoc_tpl_struct.cpp : : : : ]
|
[ run sequence/define_assoc_tpl_struct.cpp : : : : ]
|
||||||
|
[ run sequence/std_tuple.cpp : : : : ]
|
||||||
[ run sequence/std_tuple_iterator.cpp : : : : ]
|
[ run sequence/std_tuple_iterator.cpp : : : : ]
|
||||||
[ run sequence/ref_vector.cpp : : : : ]
|
[ run sequence/ref_vector.cpp : : : : ]
|
||||||
[ run sequence/flatten_view.cpp : : : : ]
|
[ run sequence/flatten_view.cpp : : : : ]
|
||||||
|
47
test/sequence/std_tuple.cpp
Normal file
47
test/sequence/std_tuple.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2014 Kohei Takahashi
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
==============================================================================*/
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||||
|
|
||||||
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_tuple.hpp>
|
||||||
|
#include <boost/fusion/sequence/convert.hpp>
|
||||||
|
#include <boost/fusion/container/vector/vector.hpp>
|
||||||
|
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||||
|
#include <tuple>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
using namespace boost::fusion;
|
||||||
|
using namespace boost;
|
||||||
|
|
||||||
|
// The convert only supports implementations using variadic templates
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
{
|
||||||
|
// conversion vector to std tuple
|
||||||
|
std::tuple<int, std::string> t = convert<std_tuple_tag>(make_vector(123, "Hola!!!"));
|
||||||
|
BOOST_TEST(std::get<0>(t) == 123);
|
||||||
|
BOOST_TEST(std::get<1>(t) == "Hola!!!");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user