
On 12/3/04 4:59 PM, "Jonathan Turkanis" <technews@kangaroologic.com> wrote:
Attached is some non-conforming code which automatically assigns a unique integer id to an arbitrary type. It's based on this post by Daniel Wallin:
http://lists.boost.org/MailArchives/boost/msg69842.php [TRUNCATE]
I take that computing these IDs at compile-time is a requirement? Otherwise you could use something like: reinterpret_cast<unsigned>(static_cast<void const *>(&typeid(T))); This assumes that a void-pointer can fit within an unsigned. If not, use the appropriate type that corresponds to C-1999's "uintptr_t". (Of course it's possible that there's _no_ integral type big enough to fit a pointer. In that case, my plan is screwed.) -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com