CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Why don't templated typedefs exist ?

    Hi,

    I ran into a problem earlier today when trying to declare a templated typedef like :
    Code:
    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 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 ?

  2. #2
    Join Date
    Sep 2002
    Posts
    1,747

    crazy = lazy = job security

    The two reasons mentioned in the Coda seem to point to the ultimate reason:

    Without typedef templates in the standard the committee has yet another reason to reconvene and fix it. Their jobs are thus secured for another round of standardization and they need not find real jobs in the marketplace.

    I hope that reason is not too cynical...

  3. #3
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588
    lol that is cynical, but I guess you are just being cynical yourself

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured