Boost logo

Boost :

Subject: Re: [boost] [any] new version
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-09-02 13:33:15


On Fri, Sep 2, 2011 at 9:06 AM, Nigel Stewart <nigels.com_at_[hidden]> wrote:
[...]

> > 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.
>

For the "compile-time trick", I'd guess the closest thing would be what
Boost.TypeOf does. And I don't see that being practical for this
application.

- Jeff


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