[v3] deprecated ext/hash_map, ext/hash_set

David Fang fang@csl.cornell.edu
Wed Oct 17 23:38:00 GMT 2007


> "Benjamin Kosnik" <bkoz@redhat.com> writes:
>
> | For my next couple tricks, I will be attempting to deprecate (in C++0x
> | mode) auto_ptr, binder1st, and vector<bool>.
>
> I believe we should exercise extra conservatism about those.
>
> -- Gaby

Hi,

This may be slightly off-topic, but this thread raises some concerns. 
Since standard adoption isn't likely to happen overnight, I'd like to 
prepare code to be ready for upgrading.  Having a typedef template 
mechanism for migration of class templates could be very helpful in 
'porting' C++ STL code across the two C++ standards.  Did typedef 
templates ever make it into C++0x?  That last reference I could find to 
them (various proposals) is dated several years back, maybe I haven't 
looked hard enough?

I'm imagining user code like:

#include <header>
// something no longer in newer standard:
// template <typename T> class deprecated_class { ... };

#if CXX0X
// assuming the following is legal:
template <typename T> typedef deprecated_class<T> replacement_class;
#endif

// can continue using deprecated_class interface that's common
// to the replacement_class interface

The goal is to use the newer standard's replacement if detected (e.g. with 
autoconf), else fall back to the old class, but in user code, refer to one 
name only through the use of a conditionally defined typedef.

(thinking out loud)

Fang



More information about the Libstdc++ mailing list