Sign in to follow this  

using typedef on templated structures

This topic is 4834 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

C++ doesn't yet support using template parameters with typedefs, so FireNet has described the only way you can do it which is to create a separate typedef for every template parameter type you want to use. However, see this for something that might help.

Share this post


Link to post
Share on other sites
Are you sure? My string.stl file has this definition

typedef basic_string<char, char_traits<char> > string;
typedef basic_string<wchar_t, char_traits<wchar_t> > wstring;

Or am I once again missing the point?

Share this post


Link to post
Share on other sites
You are defining the template paramaters and placing them in a constant, they are saying the you couldn't do

template <class T>
struct MyStruct { ... };

typedef MyStruct Here;

and then use Here<int>.

Share this post


Link to post
Share on other sites

This topic is 4834 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.

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