Jump to content
  • Advertisement
Sign in to follow this  
CProgrammer

using typedef on templated structures

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

I want to do something like this:
template <class T>
struct MyStruct...

typedef MyStruct* Something
How can I implement this with templated structs. -CProgrammer

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!