AMDG
Edd Dawson wrote:
> The following code compiles fine against Boost 1.34.1 and 1.35.0, but
> apparently not anything later. I've tried 1.36.0 and 1.39.0.
>
> I'm compiling with Microsoft's Visual C++ 2005 and 2009 compilers (the
> express editions if it matters).
>
>
> #include <boost/mpl/remove.hpp>
> #include <boost/mpl/vector.hpp>
> #include <boost/preprocessor/repetition/enum_params.hpp>
> #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
>
> template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_LIMIT_VECTOR_SIZE,
> typename T, void)>
> struct X
> {
> typedef typename
>
> boost::mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MPL_LIMIT_VECTOR_SIZE,
> T)>::type
> template_parameters; // mpl::vector of template parameters
>
> typedef typename boost::mpl::remove
> <
> template_parameters,
> void
> >
> ::type template_parameters_no_voids; // voids removed
> };
>
> int main()
> {
> X<int> x;
> return 0;
> }
>
>
> The error messages using Boost 1.39.0 and Visual C++ 2005:
>
> <snip>
>
> Is this a problem with more recent versions of Boost, or am I doing
> something wrong?
>
> It looks like it's complaining because an mpl::vector of maximal
> static size doesn't implement push_back, but it surely shouldn't need
> to for a remove operation?
The first problem is that remove is implemented by calling either
push_back or push_front on an empty sequence. The
error occurs when remove is deciding whether it can use
push_back. inserter_algorithm.hpp.patch fixes the problem
by calling clear on the argument before running the test.
The second problem is that has_push_back is broken.
push_back_impl.hpp.patch should fix it.
In Christ,
Steven Watanabe
Index: boost/mpl/aux_/inserter_algorithm.hpp
===================================================================
--- boost/mpl/aux_/inserter_algorithm.hpp (revision 54788)
+++ boost/mpl/aux_/inserter_algorithm.hpp (working copy)
@@ -49,7 +49,7 @@
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
> \
struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
- : if_< has_push_back<P1> \
+ : if_< has_push_back< typename clear<P1>::type> \
, aux::name##_impl< \
BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
, back_inserter< typename clear<P1>::type > \
Index: boost/mpl/aux_/push_back_impl.hpp
===================================================================
--- boost/mpl/aux_/push_back_impl.hpp (revision 54788)
+++ boost/mpl/aux_/push_back_impl.hpp (working copy)
@@ -25,8 +25,7 @@
namespace boost { namespace mpl {
-template< typename Tag >
-struct has_push_back_impl;
+struct has_push_back_arg;
// agurt 05/feb/04: no default implementation; the stub definition is needed
// to enable the default 'has_push_back' implementation below
@@ -39,7 +38,7 @@
// if you've got an assert here, you are requesting a 'push_back'
// specialization that doesn't exist.
BOOST_MPL_ASSERT_MSG(
- ( boost::is_same< T, has_push_back_impl<T> >::value )
+ ( boost::is_same< T, has_push_back_arg >::value )
, REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST
, ( Sequence )
);
@@ -51,13 +50,13 @@
{
template< typename Seq > struct apply
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
- : aux::has_type< push_back< Seq, has_push_back_impl<Tag> > >
+ : aux::has_type< push_back< Seq, has_push_back_arg > >
{
#else
{
- typedef aux::has_type< push_back< Seq, has_push_back_impl<Tag> > > type;
+ typedef aux::has_type< push_back< Seq, has_push_back_arg > > type;
BOOST_STATIC_CONSTANT(bool, value =
- (aux::has_type< push_back< Seq, has_push_back_impl<Tag> > >::value)
+ (aux::has_type< push_back< Seq, has_push_back_arg > >::value)
);
#endif
};
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost