Subject: Re: [boost] [type_index] C++03 implementation in boost?
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2012-07-01 23:32:39
On 02/07/2012 01:11 a.m., Robert Ramey wrote:
> Agustín K-ballo Bergé wrote:
>> After crafting my own `type_info_ptr` as a thin wrapper to be able to
>> use `std::type_info` as key in maps, I found out about the new
>> `std::type_index` in C++11.
>> It seems that a C++03 implementation would be trivial, except for the
>> hashing functionality. Could that functionality be built by leveraging
>> implementation specific details like whether there is only one
>> `type_info` instance for each type, or whether the name member
>> function returns distinct values?
>> I believe it would be a nice addition to Boost, perhaps as part of the
>> utility library. It would be useful for those wanting to use C++11
>> features while still writing C++03 compatible code.
>> Agustín K-ballo Bergé.-
> It sounds like this might be similar to the "extended_type_info" used
> in the serialization library for many years.
> Robert Ramey
It's considerably simpler than `extended_type_info`. It's just a wrapper
around a `std::type_info const*` that is usable as a key in associative
sequences (both ordered and unordered). Nothing more, nothing less.
Agustín K-ballo Bergé.-
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk