libstdc++ debug mode ideas 3

Alexandre Oliva aoliva@redhat.com
Mon Aug 11 23:04:00 GMT 2003


On Aug  6, 2003, Benjamin Kosnik <bkoz@redhat.com> wrote:

> I think a perfect template aliasing model would make the problem go 
> away because we could do this:

> namespace std {
>    namespace __release {
>      template<typename T, typename Allocator = std::allocator<T> >
>        class vector; // define release-mode vector
>    }
>    namespace __debug {
>      template<typename T, typename Allocator = std::allocator<T> >
>        class vector; // define debug-mode vector
>    }
> }

We'd need such a perfect template aliasing model to enable one to
specialize templates in namespaces other than the one in which the
template was defined.  Where we stand now, a number of our customers
are running into problems specializing template code that moved from
the global namespace to namespace std or __gnu_cxx.  Unfortunately we
reject specializations that are not syntactically inside namespace
blocks that match that of the original declaration.  I *think* this is
mandated by the Standard, which is quite unfortunate.  Ideally, one
should be able to specialize templates without having to know exactly
in which namespace they were initially declared, sufficing it to be
able to find the original template decl by name lookup.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Libstdc++ mailing list