Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-05-06 08:17:53


Joel <joel_at_[hidden]> writes:

> Joel wrote:
>> Brian Braatz wrote:
>>
>>> Could it be as simple as missing the namespace on the is_sqeuence<>
>>> call?
>> Have you tried it? If it was, I wouldn't have bothered the list ;-)
>> Try replacing int_<0> with int.
>
> I think the problem is the way mpl::is_sequence is implemented.
> It tries to detect the presence of a "tag" typedef and a "begin"
> typedef and concludes that a type is an mpl::sequence if it
> has both. I've complained a long time ago about this. I think
> this behavior is error prone. It's quite easy to come up with
> a situation where I have a type T with a "tag" and a "begin"
> but is not an MPL sequence. There must be a better way. MPL
> should not monopolize on the usage of "tag" and a "begin"
> in a type.

I never liked is_sequence in the first place.

1. Anything that makes structural checks is prone to masquerades like
   the one you cite.

2. Whenever you check if something is a sequence and do something
   different based on that fact, genericity is broken. We went
   through this discussion with boost::variant.

Are you sure you want to be using even a perfect implementation of
is_sequence?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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