Yves M
October 30th, 2002, 01:22 PM
Hi,
I ran into a problem earlier today when trying to declare a templated typedef like :
template <class CmpFunc>
typedef std::set<int, CmpFunc> INTSET<CmpFunc>;
At first I thought I got the syntax wrong, but it became clear that my compiler didn't support this. So I checked around the web and found this article (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndeepc/html/deep08032000.asp) on MSDN. I'll just quote the passage that struck me:
Sadly for us, the C++ standard does not allow typedef templates. Class templates, yes. Function templates, yes. Typedef templates, no.
Is there any reason why the standard doesn't allow typedef templates ?
I ran into a problem earlier today when trying to declare a templated typedef like :
template <class CmpFunc>
typedef std::set<int, CmpFunc> INTSET<CmpFunc>;
At first I thought I got the syntax wrong, but it became clear that my compiler didn't support this. So I checked around the web and found this article (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndeepc/html/deep08032000.asp) on MSDN. I'll just quote the passage that struck me:
Sadly for us, the C++ standard does not allow typedef templates. Class templates, yes. Function templates, yes. Typedef templates, no.
Is there any reason why the standard doesn't allow typedef templates ?