Boost logo

Boost :

From: Stjepan Rajko (stipe_at_[hidden])
Date: 2007-12-05 13:14:18


On Dec 2, 2007 11:04 AM, Mathias Gaunard <mathias.gaunard_at_[hidden]> wrote:
> Meta-Programming, as used in Boost.MPL and others, allows to compute
> arbitrary values at compile-time, in a Turing-complete manner.
>
> However, something like generating unique identifiers at compile-time,
> which would be fairly useful, requires some kind of entropy source to
> create a random seed.
>
> One can maybe extract some entropy from macros such as __DATE__ and
> __TIME__, using both preprocessing and templates.
>
> Among you boosters, which are well known for your interesting in
> meta-programming, is there someone who ever tried to look into this?
>

OK, this is funny - on GCC 4.0.1/darwin, I was able to:

#include __DATE__

which means you can have a date-based seed given a huge number of
files to include. I don't know if this works with all compilers
though.

Too bad #include __TIME__ doesn't work, because of ":"s in the
literal... but maybe someone can take this further and figure
something out.

Stjepan


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