Topic: template template parameters and the related interdiction of...


Author: kavdeiv@mail.ru (Kiril Avdeiv)
Date: Sun, 27 May 2001 19:04:59 GMT
Raw View
Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr> wrote in message news:<fl8zjmfm3h.fsf@sel.cmla.ens-cachan.fr>...
> kavdeiv@mail.ru (Kiril Avdeiv) writes:
>
> | Can anyone explain how detecting the extra template parameters through
> | template template parameters work.
>
>
>    template<template<typename> class Container>
>    void foo() { /* ... */ }
>
>    #include <valarray>
>
>    int main()
>    {
>       foo<std::valarray>();
>    }
>
> This won't work if there is an additional parameter (even hidden) for
> std::valarray -- yes, I know there is out there a broken compiler
> which doesn't mind about template template argument signture matching.

Thank you Gabriel!

Kiril

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: kavdeiv@mail.ru (Kiril Avdeiv)
Date: Thu, 24 May 2001 21:20:08 GMT
Raw View
I posted this one to comp.lang.c++.moderated but no one was able to
answer. Given that it's LWG's library issue list that made me write
that post, I hope to find an answer here...

On this new group I got to hear that the reason why extra template
parameters for the standard library classes are prohibited (even if
default template arguments are given) is because "it seems added
template parameters can be detected by a program using
template-template parameters".

Can anyone explain how detecting the extra template parameters through
template template parameters work.

Thank you
Kiril.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
Date: Thu, 24 May 2001 22:03:31 GMT
Raw View
kavdeiv@mail.ru (Kiril Avdeiv) writes:

| Can anyone explain how detecting the extra template parameters through
| template template parameters work.


   template<template<typename> class Container>
   void foo() { /* ... */ }

   #include <valarray>

   int main()
   {
      foo<std::valarray>();
   }

This won't work if there is an additional parameter (even hidden) for
std::valarray -- yes, I know there is out there a broken compiler
which doesn't mind about template template argument signture matching.

--
Gabriel Dos Reis, dosreis@cmla.ens-cachan.fr

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]