Fan*_*Fan 5 c++ static-assert inner-classes default-constructor type-traits
以下代码编译:
struct Bar
{
struct Foo
{
int v = 0;
};
// If uncomment the following line, both static assert will fail
// static_assert(std::is_default_constructible_v<Foo>);
};
static_assert(std::is_default_constructible_v<Bar::Foo>);
Run Code Online (Sandbox Code Playgroud)
但是如果我取消注释 first static_assert,两者static_assert都会失败。这怎么会发生?
请参阅http://coliru.stacked-crooked.com/a/64e9c020056e37ed 中的代码
| 归档时间: |
|
| 查看次数: |
38 次 |
| 最近记录: |