Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion]simple fusion seq_size fails to compile
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-05-16 17:44:58


On 05/16/10 16:17, Pete Bartlett wrote:
>> Compilation of attachment 1 with gcc-4.5, produces errors in attachment 2.
> When the >'#if 1' on line 24 is changed to '#if 0', it compiles OK.
>> What am I doing wrong?
>>
>> TIA.
>
> In the second "inner" instantiation of seq_size (ie the one taking in an
> empty sequence), what return type /could/ pop_front have? So intuitively a
> compile error is what I would expect here - and I think a literal reading of
> the documentation agrees because an empty sequence does not satisfy the
> fusion Sequence concept.

Thanks Pete.

However, I was hoping the test, !empty(a_seq), would prevent executing
pop_front on an empty sequence. I guess that the compiler goes ahead
and instantiates it and that's what's causing the problem.

But how else would one calculate the length of a
sequence? (Note, I know there's already a function, size, doing this.
I'm just trying to figure out how to do something like that.)
Hmm... maybe I should look at size implementation?

-regards,
Larry


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