Topic: What's the rationale of not allowing this usage[template aliases]


Author: pongba@gmail.com
Date: Sun, 20 May 2007 16:19:54 CST
Raw View
template<typename T>
using Vec = std::vector<T, allocator<T>>;

template<template<typename> class TT>
struct S;

S<Vec>;

It will solve the long-standed problem of not being able to default
some parameter of a template and treat it like one with fewer
parameters.

---
[ 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.comeaucomputing.com/csc/faq.html                      ]





Author: Alberto Ganesh Barbati <AlbertoBarbati@libero.it>
Date: Sun, 20 May 2007 21:05:48 CST
Raw View
pongba@gmail.com ha scritto:
> template<typename T>
> using Vec = std::vector<T, allocator<T>>;
>
> template<template<typename> class TT>
> struct S;
>
> S<Vec>;
>
> It will solve the long-standed problem of not being able to default
> some parameter of a template and treat it like one with fewer
> parameters.
>

AFAIK, it *is* allowed. I may be wrong, but that's how I interpret
14.3.3/1 in the latest draft (with emphasis added): "A template-argument
for a template template-parameter shall be the name of a class template
*or a template alias*, expressed as id-expression."

What makes you think it isn't allowed?

Ganesh

---
[ 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.comeaucomputing.com/csc/faq.html                      ]