Topic: Why are template typedefs not allowed?
Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Tue, 13 Apr 2004 16:50:11 +0000 (UTC) Raw View
Why are template typedefs not allowed? In the absence of this, we have
to unnecessarily use a struct (or a class or a union) to scope the
typedef. Had
template typedefs been allowed, we could have written:
template<typename T>
class allocator
{
public:
//...
template<typename U> typedef allocator<U> rebind;
};
template <typename T, typename A=allocator<T> >
class list
{
//here, typename A::template rebind<_Link> would be a type, provided
_Link is a type
//...
};
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: pvidler@mailblocks.com (Pete Vidler)
Date: Tue, 13 Apr 2004 22:32:16 +0000 (UTC) Raw View
Prateek R Karandikar wrote:
> Why are template typedefs not allowed? In the absence of this, we have
> to unnecessarily use a struct (or a class or a union) to scope the
> typedef.
[snip]
I'm fairly certain it was an oversight. I believe we will get them with
the next standard.
Check out:
http://www.gotw.ca/publications/N1406.pdf
http://www.cuj.com/experts/2012/sutter.htm
I can't seem to access the second one ATM, though.
-- Pete
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: francis@robinton.demon.co.uk (Francis Glassborow)
Date: Wed, 14 Apr 2004 06:09:29 +0000 (UTC) Raw View
In article <l1Vec.147$xN.1@newsfe1-gui.server.ntli.net>, Pete Vidler
<pvidler@mailblocks.com> writes
>Prateek R Karandikar wrote:
>> Why are template typedefs not allowed? In the absence of this, we have
>> to unnecessarily use a struct (or a class or a union) to scope the
>> typedef.
>[snip]
>
>I'm fairly certain it was an oversight. I believe we will get them with
>the next standard.
No, not an oversight; deciding exactly what a template typedef should be
is far from trivial as we have found when considering proposals to
introduce them to the language.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]