我有一個模板類C++模板的typedef
template <T>
class Example
{
...
};
內部有 是以下類型的許多方法:
template <class U> <class V> method(....)
裏面這些我使用TR1 :: shared_ptr的以U或V或T.
它繁瑣的打字tr1::shared_ptr<const U>
或tr1::shared_ptr<const V>
。
顯而易見的事情:
template <typename U>
typedef tr1::shared_ptr<U> shptr<U>;
不起作用。
你在這種情況下做什麼?任何可以減少冗長的東西?
Duplicates:http://stackoverflow.com/questions/562209/typedef-std-containers,http://stackoverflow.com/questions/1474417/typedef-a-template-class-without-specifying-the-template -parameters,http://stackoverflow.com/questions/544842/c-typedef-ing-stl – 2010-02-10 18:39:57
我不知道他們是重複的,他們肯定是相關的,並可能有興趣瀏覽答案,但確切的重複? – 2010-02-10 20:15:59