 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Prateek R Karandikar Guest
|
Posted: Tue Apr 13, 2004 4:50 pm Post subject: Why are template typedefs not allowed? |
|
|
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
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 ]
|
|
| Back to top |
|
 |
Pete Vidler Guest
|
Posted: Tue Apr 13, 2004 10:32 pm Post subject: Re: Why are template typedefs not allowed? |
|
|
Prateek R Karandikar wrote:
| Quote: | 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 ]
|
|
| Back to top |
|
 |
Francis Glassborow Guest
|
Posted: Wed Apr 14, 2004 6:09 am Post subject: Re: Why are template typedefs not allowed? |
|
|
In article <l1Vec.147$xN.1 (AT) newsfe1-gui (DOT) server.ntli.net>, Pete Vidler
<pvidler (AT) mailblocks (DOT) com> writes
| Quote: | 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 ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|