mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-23 17:17:23 +02:00
Merge pull request #90 from Flast/feature/variadic/nview
Variadic fusion::nview.
This commit is contained in:
@ -9,7 +9,6 @@
|
||||
#define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/advance.hpp>
|
||||
#include <boost/fusion/iterator/advance.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
@ -30,11 +29,11 @@ namespace boost { namespace fusion
|
||||
template<typename Iterator, typename Dist>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::first_type::iterator_type iterator_type;
|
||||
typedef typename Iterator::first_type iterator_type;
|
||||
typedef typename Iterator::sequence_type sequence_type;
|
||||
|
||||
typedef nview_iterator<sequence_type,
|
||||
typename mpl::advance<iterator_type, Dist>::type> type;
|
||||
typename result_of::advance<iterator_type, Dist>::type> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/value_at.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -29,7 +30,7 @@ namespace boost { namespace fusion
|
||||
typedef typename Sequence::sequence_type sequence_type;
|
||||
typedef typename Sequence::index_type index_type;
|
||||
|
||||
typedef typename result_of::at<index_type, N>::type index;
|
||||
typedef typename result_of::value_at<index_type, N>::type index;
|
||||
typedef typename result_of::at<sequence_type, index>::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define BOOST_FUSION_NVIEW_BEGIN_IMPL_SEP_23_2009_1036PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
@ -33,7 +32,7 @@ namespace boost { namespace fusion
|
||||
typedef typename Sequence::index_type index_type;
|
||||
|
||||
typedef nview_iterator<Sequence,
|
||||
typename mpl::begin<index_type>::type> type;
|
||||
typename result_of::begin<index_type>::type> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& s)
|
||||
|
@ -17,10 +17,13 @@
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (1, FUSION_MAX_VECTOR_SIZE, \
|
||||
"boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \
|
||||
"boost/fusion/view/nview/detail/cpp03/nview_impl.hpp")) \
|
||||
/**/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -9,8 +9,8 @@
|
||||
#define BOOST_FUSION_NVIEW_DEREF_IMPL_SEP_24_2009_0818AM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/deref.hpp>
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
#include <boost/fusion/iterator/value_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -30,7 +30,7 @@ namespace boost { namespace fusion
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::sequence_type sequence_type;
|
||||
|
||||
typedef typename result_of::deref<first_type>::type index;
|
||||
typedef typename result_of::value_of<first_type>::type index;
|
||||
typedef typename result_of::at<
|
||||
typename sequence_type::sequence_type, index>::type type;
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define BOOST_FUSION_NVIEW_END_IMPL_SEP_24_2009_0140PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/end.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
@ -34,7 +33,7 @@ namespace boost { namespace fusion
|
||||
typedef typename Sequence::index_type index_type;
|
||||
|
||||
typedef nview_iterator<Sequence,
|
||||
typename mpl::end<index_type>::type> type;
|
||||
typename result_of::end<index_type>::type> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& s)
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define BOOST_FUSION_NVIEW_NEXT_IMPL_SEP_24_2009_0116PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
#include <boost/fusion/iterator/next.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -29,11 +29,11 @@ namespace boost { namespace fusion
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::first_type::iterator_type first_type;
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::sequence_type sequence_type;
|
||||
|
||||
typedef nview_iterator<sequence_type,
|
||||
typename mpl::next<first_type>::type> type;
|
||||
typename result_of::next<first_type>::type> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
|
@ -8,11 +8,43 @@
|
||||
#define BOOST_FUSION_NVIEW_IMPL_17122014_1948
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/container/vector/detail/config.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Without variadics, we will use the PP version
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
|
||||
# include <boost/fusion/view/nview/detail/cpp03/nview_impl.hpp>
|
||||
#else
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// C++11 interface
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, int ...I>
|
||||
struct as_nview
|
||||
{
|
||||
typedef vector<mpl::int_<I>...> index_type;
|
||||
typedef nview<Sequence, index_type> type;
|
||||
};
|
||||
}
|
||||
|
||||
template <int ...I, typename Sequence>
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline nview<Sequence, vector<mpl::int_<I>...> >
|
||||
as_nview(Sequence& s)
|
||||
{
|
||||
typedef vector<mpl::int_<I>...> index_type;
|
||||
return nview<Sequence, index_type>(s);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define BOOST_FUSION_NVIEW_PRIOR_IMPL_SEP_24_2009_0142PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/prior.hpp>
|
||||
#include <boost/fusion/iterator/prior.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -29,11 +29,11 @@ namespace boost { namespace fusion
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::first_type::iterator_type first_type;
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::sequence_type sequence_type;
|
||||
|
||||
typedef nview_iterator<sequence_type,
|
||||
typename mpl::prior<first_type>::type> type;
|
||||
typename result_of::prior<first_type>::type> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
|
@ -9,19 +9,15 @@
|
||||
#define BOOST_FUSION_NVIEW_SEP_23_2009_0948PM
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
#include <boost/fusion/support/is_view.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/support/sequence_base.hpp>
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/size.hpp>
|
||||
#include <boost/fusion/view/transform_view.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@ -99,7 +95,7 @@ namespace boost { namespace fusion
|
||||
|
||||
typedef mpl::true_ is_view;
|
||||
typedef Indicies index_type;
|
||||
typedef typename mpl::size<Indicies>::type size;
|
||||
typedef typename result_of::size<Indicies>::type size;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
is_const<Sequence>, detail::addconstref, detail::addref
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/begin.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/adapted/mpl/mpl_iterator.hpp>
|
||||
|
||||
#include <boost/fusion/view/nview/detail/size_impl.hpp>
|
||||
#include <boost/fusion/view/nview/detail/begin_impl.hpp>
|
||||
@ -40,7 +39,7 @@ namespace boost { namespace fusion
|
||||
typedef random_access_traversal_tag category;
|
||||
|
||||
typedef Sequence sequence_type;
|
||||
typedef mpl_iterator<Pos> first_type;
|
||||
typedef Pos first_type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
explicit nview_iterator(Sequence& in_seq)
|
||||
|
Reference in New Issue
Block a user