using typedef on templated structures

Started by
3 comments, last by Stephen R 19 years, 7 months ago
I want to do something like this:

template <class T>
struct MyStruct...

typedef MyStruct* Something
How can I implement this with templated structs. -CProgrammer
Advertisement
typedef MyStruct<Something *> Name;

or

typedef MyStruct<Something> *Name;
______________________________________________________________________________________________________
[AirBash.com]
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.
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?
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>.

This topic is closed to new replies.

Advertisement