revert to prior (again).

[SVN r73692]
This commit is contained in:
Joel de Guzman
2011-08-12 07:24:00 +00:00
parent faa5746f6d
commit 8b80a11877

View File

@ -1,7 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2006 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/ ==============================================================================*/
#if !defined(FUSION_POP_BACK_09172005_1038) #if !defined(FUSION_POP_BACK_09172005_1038)
@ -10,9 +10,7 @@
#include <boost/fusion/view/iterator_range/iterator_range.hpp> #include <boost/fusion/view/iterator_range/iterator_range.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp> #include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp> #include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/iterator/advance.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -21,14 +19,13 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
struct pop_back struct pop_back
{ {
static int const size = size<Sequence>::value; typedef
BOOST_STATIC_ASSERT(size > 0); iterator_range<
typedef typename begin<Sequence>::type begin_type; typename begin<Sequence>::type
typedef mpl::int_<size-1> end_index; , typename prior<
typedef typename advance<begin_type, end_index>::type end_type; typename end<Sequence>::type
>::type
typedef >
iterator_range<begin_type, end_type>
type; type;
}; };
} }
@ -37,12 +34,8 @@ namespace boost { namespace fusion
inline typename result_of::pop_back<Sequence const>::type inline typename result_of::pop_back<Sequence const>::type
pop_back(Sequence const& seq) pop_back(Sequence const& seq)
{ {
typedef typename
result_of::pop_back<Sequence const>::end_index
end_index;
typedef typename result_of::pop_back<Sequence const>::type result; typedef typename result_of::pop_back<Sequence const>::type result;
return result(fusion::begin(seq), fusion::advance<end_index>(fusion::begin(seq))); return result(fusion::begin(seq), fusion::prior(fusion::end(seq)));
} }
}} }}