Boost logo

Boost :

Subject: Re: [boost] [any] new version
From: Nigel Stewart (nigels.com_at_[hidden])
Date: 2011-09-02 12:06:52

> Do not reinvent RTTI

And yet, many code bases DO reinvent RTTI, for various reasons.
I work with code that is not allowed to depend on C++ runtime libraries,
so standard RTTI is out of the question.

> Please don't do this!
> unsigned int next_id()
> {
>    static unsigned int previous_id = 0;   //0 is not assigned to a type
>    ++previous_id;
>    return previous_id;
> }

Indeed, runtime allocation of unique identifiers is problematic.
But perhaps there is some kind of compile-time trick, apart
from manually assigning enums in some central header.
And ideally, portable across compilers so that foo.dll and
bar.dll would be consistant without being build by the same
vendor, or toolchains.

- Nigel

Boost list run by bdawes at, gregod at, cpdaniel at, john at