mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-30 04:27:30 +02:00
Merge pull request #99 from Flast/bugfix/issue-11572
Retrieve convert<deque_tag>.
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
/*=============================================================================
|
/*=============================================================================
|
||||||
Copyright (c) 2005-2012 Joel de Guzman
|
Copyright (c) 2005-2012 Joel de Guzman
|
||||||
Copyright (c) 2005-2006 Dan Marsden
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
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)
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@ -12,7 +13,7 @@
|
|||||||
#include <boost/fusion/container/deque/convert.hpp>
|
#include <boost/fusion/container/deque/convert.hpp>
|
||||||
#include <boost/fusion/container/deque/deque.hpp>
|
#include <boost/fusion/container/deque/deque.hpp>
|
||||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||||
|
|
||||||
namespace boost { namespace fusion
|
namespace boost { namespace fusion
|
||||||
{
|
{
|
||||||
@ -41,7 +42,11 @@ namespace boost { namespace fusion
|
|||||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||||
static type call(Sequence& seq)
|
static type call(Sequence& seq)
|
||||||
{
|
{
|
||||||
return gen::call(seq);
|
return gen::call(fusion::begin(seq)
|
||||||
|
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
|
||||||
|
, fusion::end(seq)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,7 @@ namespace boost { namespace fusion
|
|||||||
{
|
{
|
||||||
template <typename Sequence>
|
template <typename Sequence>
|
||||||
struct as_deque
|
struct as_deque
|
||||||
|
: detail::as_deque<result_of::size<Sequence>::value>
|
||||||
{
|
{
|
||||||
typedef typename
|
typedef typename
|
||||||
detail::as_deque<result_of::size<Sequence>::value>
|
detail::as_deque<result_of::size<Sequence>::value>
|
||||||
|
@ -65,6 +65,12 @@ project
|
|||||||
[ run sequence/boost_tuple.cpp : : : : ]
|
[ run sequence/boost_tuple.cpp : : : : ]
|
||||||
[ run sequence/boost_tuple_iterator.cpp : : : : ]
|
[ run sequence/boost_tuple_iterator.cpp : : : : ]
|
||||||
[ run sequence/cons.cpp : : : : ]
|
[ run sequence/cons.cpp : : : : ]
|
||||||
|
[ run sequence/convert_boost_tuple.cpp : : : : ]
|
||||||
|
[ run sequence/convert_deque.cpp : : : : ]
|
||||||
|
[ run sequence/convert_list.cpp : : : : ]
|
||||||
|
[ run sequence/convert_std_pair.cpp : : : : ]
|
||||||
|
[ run sequence/convert_std_tuple.cpp : : : : ]
|
||||||
|
[ run sequence/convert_vector.cpp : : : : ]
|
||||||
[ run sequence/filter_view.cpp : : : : ]
|
[ run sequence/filter_view.cpp : : : : ]
|
||||||
[ run sequence/hash.cpp : : : : ]
|
[ run sequence/hash.cpp : : : : ]
|
||||||
[ run sequence/io.cpp : : : : ]
|
[ run sequence/io.cpp : : : : ]
|
||||||
|
51
test/sequence/convert.hpp
Normal file
51
test/sequence/convert.hpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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 <string>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
#include <boost/fusion/include/convert.hpp>
|
||||||
|
#include <boost/fusion/include/at.hpp>
|
||||||
|
|
||||||
|
#include <boost/fusion/include/vector.hpp>
|
||||||
|
#include <boost/fusion/include/deque.hpp>
|
||||||
|
#include <boost/fusion/include/list.hpp>
|
||||||
|
#include <boost/fusion/include/boost_tuple.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
#include <boost/fusion/include/std_tuple.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename Tag>
|
||||||
|
void test(FUSION_SEQUENCE<int, std::string> const& seq)
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
boost::fusion::result_of::convert<
|
||||||
|
Tag
|
||||||
|
, FUSION_SEQUENCE<int, std::string>
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
type v = boost::fusion::convert<Tag>(seq);
|
||||||
|
BOOST_TEST((boost::fusion::at_c<0>(v) == 123));
|
||||||
|
BOOST_TEST((boost::fusion::at_c<1>(v) == "Hola!!!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
FUSION_SEQUENCE<int, std::string> seq(123, "Hola!!!");
|
||||||
|
test<boost::fusion::vector_tag>(seq);
|
||||||
|
test<boost::fusion::deque_tag>(seq);
|
||||||
|
test<boost::fusion::cons_tag>(seq);
|
||||||
|
test<boost::fusion::boost_tuple_tag>(seq);
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
test<boost::fusion::std_tuple_tag>(seq);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
|
14
test/sequence/convert_boost_tuple.cpp
Normal file
14
test/sequence/convert_boost_tuple.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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/tuple/tuple.hpp>
|
||||||
|
#include <boost/fusion/include/boost_tuple.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::tuples::tuple
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
13
test/sequence/convert_deque.cpp
Normal file
13
test/sequence/convert_deque.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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/fusion/include/deque.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::fusion::deque
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
13
test/sequence/convert_list.cpp
Normal file
13
test/sequence/convert_list.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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/fusion/include/list.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::fusion::list
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
14
test/sequence/convert_std_pair.cpp
Normal file
14
test/sequence/convert_std_pair.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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 <utility>
|
||||||
|
#include <boost/fusion/include/std_pair.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE std::pair
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
25
test/sequence/convert_std_tuple.cpp
Normal file
25
test/sequence/convert_std_tuple.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
#include <boost/fusion/include/std_tuple.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE std::tuple
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
13
test/sequence/convert_vector.cpp
Normal file
13
test/sequence/convert_vector.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2015 Kohei Takahashi
|
||||||
|
|
||||||
|
Use modification and distribution are subject to 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/fusion/include/vector.hpp>
|
||||||
|
|
||||||
|
#define FUSION_SEQUENCE boost::fusion::vector
|
||||||
|
#include "convert.hpp"
|
||||||
|
|
Reference in New Issue
Block a user