Implement variadic generators for fusion::vector.

This commit is contained in:
Kohei Takahashi
2014-11-11 11:16:30 +09:00
parent d937003962
commit c77f84749f
2 changed files with 59 additions and 0 deletions

View File

@ -10,7 +10,37 @@
#include <boost/fusion/support/config.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>
#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

View File

@ -8,8 +8,37 @@
#define FUSION_VECTOR_TIE_11112014_2302
#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>
#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