Tuesday, January 22, 2008

c++: 'templated' typedef

In current c++ standard(2003) you can't define typedef that uses template. But you have an opportunity to define a class/structure that has a typedef.
template<typename T>
struct __tt
{   
    typedef std::map<std::string, T> smap;
};
And use it:
__tt<int>::smap m;

No comments:

Post a Comment