模板类的typedef?

mch*_*mch 7 c++ templates typedef

是否可以typedef使用模板的长类型?例如:

template <typename myfloat_t>
class LongClassName
{
    // ...
};

template <typename myfloat_t>
typedef std::vector< boost::shared_ptr< LongClassName<myfloat_t> > > LongCollection;

LongCollection<float> m_foo;
Run Code Online (Sandbox Code Playgroud)

这不起作用,但有没有办法达到类似的效果?我只想避免键入和读取几乎涵盖编辑器窗口全宽的类型定义.

Leo*_*ans 14

不,这是目前不可能的.它将在C++ 0X AFAIK中成为可能.

我能想到的最好的是

template<typename T> struct LongCollection {
    typedef std::vector< boost::shared_ptr< LongClassName<T> > > type;
};

LongCollection<float>::type m_foo;
Run Code Online (Sandbox Code Playgroud)