Jump to content
  • Advertisement
Sign in to follow this  
Amma

[C++] typedef templates

This topic is 4793 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are typedefed templates supported in recent compilers? Eg. template<typename T> typedef std::vector<T, std::allocator<T> > bag_of<T>; doesn't work in MSC++ 7, shouldn't it?

Share this post


Link to post
Share on other sites
Advertisement
No, support for template typedefs wasn't added to the standard in the end. Recent trends in template use seem to show it really isn't that necessary.

This is a little more typing perhaps, but similar enough:


template<class T>
struct bag_of { typedef std::vector<T,std::allocator<T> > type; };

bag_of<int>::type b;

Share this post


Link to post
Share on other sites
As mentioned, the C++ standard doesn't include templated typedefs. It's one of the things I'm hoping will be included in the next update of the standard.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!