
"Daniel James" <daniel@calamity.org.uk> wrote in message news:coss3j$k2u$1@sea.gmane.org...
Jonathan Turkanis wrote:
Too bad :( That's what happens on Comeau and Metrowerks. Intel is such a strange beast -- I'm using the strict ANSI option (/Za) and the option to disable Microsoft bug emulation (/Qms0).
Here's an alternative based on a mix of Daniel Wallin and Goran Mitrovic's code.
Congrulations on figuring out Goran's code. It was written in such peculiar notation and coding-style that I gave up after a few lines.
I believe it is standards compliant.
I haven't looked at it yet, but I don't see how code which could assign different id's to the same type in different translation units could be compliant. I guess you have to take special care to ensure unique id's?
And, in theory, can allocate up to 4096 ids. It should be easy to extend it do more, although compile times will probably put you of doing that.
The problem is, that to use it you have to set the type index at the global scope and it can't be called from a template.
Yes, this seemed like a serious limitation of Goran's method based on his examples. I'd like the id to be set implicitly the first time it's queried.
Because of that, it doesn't offer much advantge over using the preprocessor to allocate ids and would probably result in larger compile times.
:(
Daniel
Best Regards, Jonathan