【发布时间】:2017-12-14 13:53:34
【问题描述】:
所以标准的this section 给出了这个例子(我的问题是内联的):
template<class T, class U>
struct Outer {
template<class X, class Y> struct Inner; // Where are X and Y from? Is this defining a struct?
template<class Y> struct Inner<T, Y>; // Is this defining a struct specialization? If so what is Y?
template<class Y> struct Inner<T, Y> { }; // I feel like this is a redefinition of the line above, could it ever not be?
template<class Y> struct Inner<U, Y> { };
};
诚然,我无法理解标准的链接部分,因为我无法理解这里发生了什么。我想我只是被所有templates 飞来飞去弄糊涂了,但是如果有人可以逐行告诉我发生了什么,那将非常有帮助。
【问题讨论】:
-
@Downvoter 我知道这被标记为 C++。您只是在 C++ 问题上提供了强制性的否决票,还是这个问题实际上有问题?
标签: c++ metaprogramming declaration definition template-specialization