C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Why are template typedefs not allowed?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Prateek R Karandikar
Guest





PostPosted: Tue Apr 13, 2004 4:50 pm    Post subject: Why are template typedefs not allowed? Reply with 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. 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





PostPosted: Tue Apr 13, 2004 10:32 pm    Post subject: Re: Why are template typedefs not allowed? Reply with quote



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





PostPosted: Wed Apr 14, 2004 6:09 am    Post subject: Re: Why are template typedefs not allowed? Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.