mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-22 00:32:53 +02:00
Implement variadic generators for fusion::vector.
This commit is contained in:
@ -10,7 +10,37 @@
|
|||||||
#include <boost/fusion/support/config.hpp>
|
#include <boost/fusion/support/config.hpp>
|
||||||
#include <boost/fusion/container/vector/vector.hpp>
|
#include <boost/fusion/container/vector/vector.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
|
||||||
# include <boost/fusion/container/generation/detail/pp_make_vector.hpp>
|
# include <boost/fusion/container/generation/detail/pp_make_vector.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++11 variadic interface
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <boost/fusion/support/detail/as_fusion_element.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename ...T>
|
||||||
|
struct make_vector
|
||||||
|
{
|
||||||
|
typedef vector<typename detail::as_fusion_element<T>::type...> type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename ...T>
|
||||||
|
BOOST_FUSION_GPU_ENABLED
|
||||||
|
inline vector<typename detail::as_fusion_element<T>::type...>
|
||||||
|
make_vector(T const&... arg)
|
||||||
|
{
|
||||||
|
return vector<typename detail::as_fusion_element<T>::type...>(arg...);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -8,8 +8,37 @@
|
|||||||
#define FUSION_VECTOR_TIE_11112014_2302
|
#define FUSION_VECTOR_TIE_11112014_2302
|
||||||
|
|
||||||
#include <boost/fusion/support/config.hpp>
|
#include <boost/fusion/support/config.hpp>
|
||||||
|
#include <boost/fusion/container/vector/detail/config.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
|
||||||
# include <boost/fusion/container/generation/detail/pp_vector_tie.hpp>
|
# include <boost/fusion/container/generation/detail/pp_vector_tie.hpp>
|
||||||
|
#else
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++11 variadic interface
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace result_of
|
||||||
|
{
|
||||||
|
template <typename ...T>
|
||||||
|
struct vector_tie
|
||||||
|
{
|
||||||
|
typedef vector<T&...> type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename ...T>
|
||||||
|
BOOST_FUSION_GPU_ENABLED
|
||||||
|
inline vector<T&...>
|
||||||
|
vector_tie(T&... arg)
|
||||||
|
{
|
||||||
|
return vector<T&...>(arg...);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user