Zhi*_*ANG 6 c++ templates constexpr c++11
请考虑以下代码:
template <typename T, typename P, T P:: *s> struct H {};
struct AA { int i; };
int main()
{
typedef int AA::*PI;
constexpr PI pi = &AA::i;
H<int, AA, &AA::i> h1; // OK
// H<int, AA, pi> h2; // compile error
}
Run Code Online (Sandbox Code Playgroud)
我有成员指针pi
指向AA::i
.
pi
是一个constexpr
变量.为什么我不能将它用作模板参数,即使&AA::i
直接使用也可以?
归档时间: |
|
查看次数: |
199 次 |
最近记录: |