template <class T>
struct MyStruct...
typedef MyStruct* Something
How can I implement this with templated structs.
-CProgrammer
using typedef on templated structures
I want to do something like this:
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?
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>.
template <class T>
struct MyStruct { ... };
typedef MyStruct Here;
and then use Here<int>.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement