|
Boost Users : |
Subject: Re: [Boost-users] [Proto] Error in FoldToList Example of Tutorial
From: Eric Niebler (eric_at_[hidden])
Date: 2010-12-25 10:00:58
On 12/25/2010 6:39 AM, Hossein Haeri wrote:
> Hi Eric,
>
> Thank you for confirming the error. But, more than having it confirmed,
> I was looking for what's going wrong there. Especially, how do I
> demystify the error message? What is it saying basically?
>
> Merry Christmas, BTW! :)
If you look at line 61 of cons.hpp, you see this:
template <typename Car, typename Cdr = nil>
struct cons : sequence_base<cons<Car, Cdr> >
{
typedef mpl::int_<Cdr::size::value+1> size;
--------------------------^^^^^^^^^
If you instantiate cons with boost::proto::_state as the Cdr parameter,
you'll get the error you saw because _state doesn't have a nested "size"
type. So somehow, Proto is instantiating cons prematurely, or else
Proto's evaluation engine failed to replace _state with the right thing
before instantiating cons.
It's either a Proto bug that got fixed sometime between then and now, or
else a compiler bug that has been worked around. Probably the former.
Merry Christmas!
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net