【发布时间】:2015-12-07 16:01:28
【问题描述】:
我有两个类需要保持彼此的引用如下:
template <typename S>
class H {
public:
H(const S& s): s_{s} {}
private:
const S& s_;
}
然后
template <typename H>
class S {
public:
S(const H& h): h_{h} {}
private:
const H& h_;
}
我无法定义类似的东西
Service<ItsHandler<Service<....>
有更好的主意吗?
【问题讨论】:
-
这里为什么需要模板?
标签: c++11 metaprogramming template-meta-programming