forked from boostorg/fusion
Initial constexpr support
This allows to use, e.g., boost::fusion::fold within constexpr functions. The BOOST_CONSTEXPR macro is used to declare functions constexpr.
This commit is contained in:
@ -75,7 +75,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <int N, typename Iterator>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::advance_c<Iterator, N>::type const
|
||||
advance_c(Iterator const& i)
|
||||
{
|
||||
@ -83,7 +83,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template<typename N, typename Iterator>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::advance<Iterator, N>::type const
|
||||
advance(Iterator const& i)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ namespace boost { namespace fusion
|
||||
basic_iterator<Tag, Category, Seq, Index + N::value>
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(It const& it)
|
||||
{
|
||||
@ -100,7 +100,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef mpl::minus<typename It2::index, typename It1::index> type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static
|
||||
type
|
||||
call(It1 const&, It2 const&)
|
||||
@ -121,18 +121,18 @@ namespace boost { namespace fusion
|
||||
{};
|
||||
|
||||
template<typename OtherSeq>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
basic_iterator(basic_iterator<Tag,Category,OtherSeq,Index> const& it)
|
||||
: seq(it.seq)
|
||||
{}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
basic_iterator(Seq& in_seq, int)
|
||||
: seq(&in_seq)
|
||||
{}
|
||||
|
||||
template<typename OtherSeq>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
basic_iterator&
|
||||
operator=(basic_iterator<Tag,Category,OtherSeq,Index> const& it)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::deref<Iterator>::type
|
||||
deref(Iterator const& i)
|
||||
{
|
||||
@ -64,7 +64,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::deref<Iterator>::type
|
||||
operator*(iterator_base<Iterator> const& i)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename It>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::deref_data<It>::type
|
||||
deref_data(It const& it)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
result_of::deref<typename Iterator::first_type>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ namespace boost { namespace fusion { namespace advance_detail
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type const&
|
||||
call(type const& i)
|
||||
{
|
||||
@ -53,7 +53,7 @@ namespace boost { namespace fusion { namespace advance_detail
|
||||
}
|
||||
|
||||
template <typename I>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(I const& i)
|
||||
{
|
||||
@ -86,7 +86,7 @@ namespace boost { namespace fusion { namespace advance_detail
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type const&
|
||||
call(type const& i)
|
||||
{
|
||||
@ -94,7 +94,7 @@ namespace boost { namespace fusion { namespace advance_detail
|
||||
}
|
||||
|
||||
template <typename I>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(I const& i)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ namespace boost { namespace fusion { namespace distance_detail
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(First const&, Last const&)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
typedef Sequence sequence_type;
|
||||
sequence_type sequence;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED explicit segment_sequence(Sequence const & seq)
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segment_sequence(Sequence const & seq)
|
||||
: sequence(seq)
|
||||
{}
|
||||
};
|
||||
@ -61,7 +61,7 @@ namespace extension
|
||||
{
|
||||
typedef typename Sequence::sequence_type type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence & seq)
|
||||
{
|
||||
return seq.sequence;
|
||||
|
@ -35,7 +35,7 @@ namespace boost { namespace fusion
|
||||
struct segmented_iterator
|
||||
: iterator_facade<segmented_iterator<Context>, forward_traversal_tag>
|
||||
{
|
||||
BOOST_FUSION_GPU_ENABLED explicit segmented_iterator(Context const& ctx)
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED explicit segmented_iterator(Context const& ctx)
|
||||
: context(ctx)
|
||||
{}
|
||||
|
||||
@ -52,7 +52,7 @@ namespace boost { namespace fusion
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(It const& it)
|
||||
{
|
||||
return *it.context.car.first;
|
||||
@ -72,7 +72,7 @@ namespace boost { namespace fusion
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(It const& it)
|
||||
{
|
||||
return fusion::deref_data(it.context.car.first);
|
||||
@ -132,7 +132,7 @@ namespace boost { namespace fusion
|
||||
typedef detail::segmented_next_impl<typename It::context_type> impl;
|
||||
typedef segmented_iterator<typename impl::type> type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(It const& it)
|
||||
{
|
||||
return type(impl::call(it.context));
|
||||
|
@ -65,7 +65,7 @@ namespace boost { namespace fusion
|
||||
cons<car_type, typename Stack::cdr_type>
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return type(
|
||||
@ -98,7 +98,7 @@ namespace boost { namespace fusion
|
||||
typedef segmented_next_impl_recurse<typename Stack::cdr_type> impl;
|
||||
typedef typename impl::type type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return impl::call(stack.cdr);
|
||||
@ -112,7 +112,7 @@ namespace boost { namespace fusion
|
||||
typedef iterator_range<end_type, end_type> range_type;
|
||||
typedef cons<range_type> type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return type(range_type(stack.car.last, stack.car.last));
|
||||
@ -147,7 +147,7 @@ namespace boost { namespace fusion
|
||||
typedef segmented_next_impl_recurse3<Stack> impl;
|
||||
typedef typename impl::type type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return impl::call(stack);
|
||||
@ -159,7 +159,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef Result type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return segmented_begin_impl<Sequence, Stack>::call(*stack.car.first, stack);
|
||||
@ -185,7 +185,7 @@ namespace boost { namespace fusion
|
||||
typename segmented_next_impl_recurse<typename Stack::cdr_type>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const& stack)
|
||||
{
|
||||
return segmented_next_impl_recurse<typename Stack::cdr_type>::call(stack.cdr);
|
||||
@ -197,7 +197,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef Next type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return pop_front_car<Stack>::call(stack);
|
||||
@ -210,7 +210,7 @@ namespace boost { namespace fusion
|
||||
typedef segmented_next_impl_recurse2<Next> impl;
|
||||
typedef typename impl::type type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return impl::call(pop_front_car<Stack>::call(stack));
|
||||
@ -236,7 +236,7 @@ namespace boost { namespace fusion
|
||||
typedef segmented_next_impl_recurse<typename Stack::cdr_type> impl;
|
||||
typedef typename impl::type type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return impl::call(stack.cdr);
|
||||
@ -248,7 +248,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef Next type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Stack const & stack)
|
||||
{
|
||||
return pop_front_car<Stack>::call(stack);
|
||||
|
@ -69,7 +69,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename First, typename Last>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::distance<First, Last>::type
|
||||
distance(First const& a, Last const& b)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ namespace boost { namespace fusion
|
||||
namespace iterator_operators
|
||||
{
|
||||
template <typename Iter1, typename Iter2>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
boost::enable_if<
|
||||
mpl::and_<is_fusion_iterator<Iter1>, is_fusion_iterator<Iter2> >
|
||||
@ -86,7 +86,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename Iter1, typename Iter2>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename
|
||||
boost::enable_if<
|
||||
mpl::and_<is_fusion_iterator<Iter1>, is_fusion_iterator<Iter2> >
|
||||
|
@ -24,7 +24,7 @@ namespace boost { namespace fusion
|
||||
iterator_base_type;
|
||||
iterator_base_type iterator_base;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
iterator_adapter(iterator_base_type const& iterator_base_)
|
||||
: iterator_base(iterator_base_) {}
|
||||
|
||||
@ -47,7 +47,7 @@ namespace boost { namespace fusion
|
||||
>::type>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
{
|
||||
@ -82,7 +82,7 @@ namespace boost { namespace fusion
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
{
|
||||
@ -100,7 +100,7 @@ namespace boost { namespace fusion
|
||||
>::type>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
@ -118,7 +118,7 @@ namespace boost { namespace fusion
|
||||
>::type>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
|
@ -31,21 +31,21 @@ namespace boost { namespace fusion
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static T const&
|
||||
call(T const& x, mpl::true_)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static mpl_iterator<T>
|
||||
call(T const& /*x*/, mpl::false_)
|
||||
{
|
||||
return mpl_iterator<T>();
|
||||
}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static typename
|
||||
mpl::if_<
|
||||
is_fusion_iterator<T>
|
||||
|
@ -54,7 +54,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::next<Iterator>::type const
|
||||
next(Iterator const& i)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
typename result_of::prior<Iterator>::type const
|
||||
prior(Iterator const& i)
|
||||
{
|
||||
|
Reference in New Issue
Block a user