Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-12-02 11:28:44


"David Abrahams" <dave_at_[hidden]> wrote

> Arkadiy Vertleyb wrote:
> > Well, it's not possible in general case, but for the purpose of typeof,
a
> > rough approximation may be enough. We can just assume that, if the type
was
> > not caught by all the specializations (generated by registration), then
it
> > *might be* one of the standard iterators. We can use SFINAE, examining
> > value_type, distance_type, etc., to increase the probability of that
> > assumption.
>
> As long as you don't mind access violations when one of those typedefs
> happens to be present, but private.

I didn't think about it, and I didn't realise SFINAE can't handle private
typedefs.

However recall that this applies only to types not registered in a normal
way. So, for these types only, we would get an error:

can't access private typedef Foo::value_type

instead of

encode_type is not defined for the type Foo

Not very nice, but arguably not an unreasonable price to pay for the ability
to register standard iterators on the typeof library level...

Unfortunately the problem doesn't seem to get solved anyway...

Arkadiy


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