【发布时间】:2010-02-10 17:23:45
【问题描述】:
我有一个模板类
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>;
不工作。
遇到这种情况你会怎么做?有什么可以减少冗长的?
【问题讨论】:
-
我不确定它们是否重复,它们肯定是相关的,浏览答案可能会很有趣,但完全重复?