Boost logo

Boost :

Subject: Re: [boost] [mpl] possible regression compiling with Visual C++
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-07-07 23:38:26


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





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk