Oli*_*liv 4 c++ alias templates language-lawyer template-aliases
考虑这个示例代码:
template <class T>
using pt_type = typename T::type;
template <class T>
class V {
using type = int;
public:
using pt = pt_type<V>;
};
void g() {
V<int>::pt a; // Does compile
pt_type<V<int>> b; // Does not compile
}
Run Code Online (Sandbox Code Playgroud)
V<int>::pt
是别名pt_type<V<int>>
.然而,它被定义的事实取决于它被引用的背景.
在C++标准中解释的是,模板参数替换模板参数是在提到别名特化的上下文中执行的?
无处.这是核心问题1554.
别名模板和访问控制的交互在14.5.7 [temp.alias]的当前措辞中并不清楚.例如:
Run Code Online (Sandbox Code Playgroud)template <class T> using foo = typename T::foo; class B { typedef int foo; friend struct C; }; struct C { foo<B> f; // Well-formed? };
归档时间: |
|
查看次数: |
104 次 |
最近记录: |