From: Daniel James (daniel_at_[hidden])
Date: 2004-08-29 10:38:31
Arkadiy Vertleyb wrote:
> I believe (and please correct me if I am wrong) that what you actually mean
> is the call to foo need to be defined as many times as actually needed as
> opposed to always BOOST_MPL_LIMIT_VECTOR_SIZE times in my implementation. I
> don't see how you can get away with defining call to foo just "once" 'cause
> you still need to do it for every "pos".
When I said defined, I was talking about the code generated by the
macro. I think you mean the number of times it is instantiated, so
> 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'.
> So I still better like the approach where TYPEOF macro expands to a single
> call to a template meta-function, with no need to automatically create
> intermediate classes. This way it can be used in any context, and we don't
> introduce additional issues related to automatic class generation at the
> call site.
I'm actually inclined to agree here. I came up with the idea a little
while ago when I first tried your typeof. I didn't think it was that
useful so I left it on the shelf. But when I saw that Peder was doing, I
saw a use for it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk