Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-08-29 12:42:59


"Daniel James" <daniel_at_[hidden]> wrote
> Arkadiy Vertleyb wrote:
> > This introduces the problem of naming such classes. You employ __LINE__
to
> > solve it, but I don't believe it's enough, since problems can easily pop
up
> > when envoking typeof from different files.
>
> I don't just use __LINE__, I also use the name of the typedef. I think
> this should be unique within the current namespace. The line number
> probably isn't needed at all. But, if this isn't acceptable then it
> could define a named struct, with the type as a member, i.e. the user
> would name the struct, and then get the type using 'name::type'.

Agreed, but this makes typedef-oriented syntax a pre-requisit rather than
just an example.

Actually I agree that comming up with a solution that would require only as
many foo<pos>() instantiations as needed (maybe it's already time to change
this function's name) would be very attractive, since it would remove that
constant time that can become quite noticable for simple types.
Unfortunaly, for the reasons I mentioned in my previous post, I don't
believe that it can be achieved without generating templates on the call
site...

Regards,
Arkadiy


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