【发布时间】:2018-06-15 20:10:38
【问题描述】:
如何将不推荐使用的属性应用于 using 语句,我可以将其应用于 typedef 而不是 using 似乎很奇怪
// Cannot do this
[[deprecated("Use a real int you wimp")]]
using Foo = int;
// This works just fine
[[deprecated("Use a real int you wimp")]]
typedef int Bar;
int main(int, char *[])
{
Foo i = 43;
(void)i;
Bar j = 34;
(void)j;
return 0;
}
【问题讨论】:
标签: attributes c++14 deprecated type-alias