Inserting elements at the beginning of Sequence, rather than at the end

This way we take advantage of the constant-time insertion and removal of
elements at the beginning of Front Extensible sequences, such as list.
This implementation is closer to the original.
This commit is contained in:
Bruno Dutra
2015-02-09 20:48:55 -02:00
parent 1c02715e49
commit c7798600d6

View File

@@ -44,7 +44,7 @@ struct insert_range_impl
> >
struct apply struct apply
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
: fold< : reverse_fold<
joint_view< joint_view<
iterator_range<typename begin<Sequence>::type,Pos> iterator_range<typename begin<Sequence>::type,Pos>
, joint_view< , joint_view<
@@ -53,12 +53,12 @@ struct insert_range_impl
> >
> >
, typename clear<Sequence>::type , typename clear<Sequence>::type
, insert<_1, end<_1>, _2> , insert<_1, begin<_1>, _2>
> >
{ {
#else #else
{ {
typedef typename fold< typedef typename reverse_fold<
joint_view< joint_view<
iterator_range<typename begin<Sequence>::type,Pos> iterator_range<typename begin<Sequence>::type,Pos>
, joint_view< , joint_view<
@@ -67,7 +67,7 @@ struct insert_range_impl
> >
> >
, typename clear<Sequence>::type , typename clear<Sequence>::type
, insert<_1, end<_1>, _2> , insert<_1, begin<_1>, _2>
>::type type; >::type type;
#endif #endif
}; };