Sign in to follow this  
Amma

[C++] typedef templates

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this