Tag: 括号初始化

为什么Clang和VS2013接受移动的大括号默认参数,而不是GCC 4.8或4.9?

就像标题所示,我有一个简短的演示程序,可以编译所有这些编译器,但在使用gcc 4.8和gcc 4.9编译后运行核心转储: 任何想法,为什么? #include <unordered_map> struct Foo : std::unordered_map<int,int> { using std::unordered_map<int, int>::unordered_map; // ~Foo() = default; // adding this allows it to work }; struct Bar { Bar(Foo f = {}) : _f(std::move(f)) {} // using any of the following constructors fixes the problem: // Bar(Foo f = Foo()) : _f(std::move(f)) {} // […]

在C ++ 11中,“return {}”语句是什么意思?

声明是什么? return {}; 在C ++ 11中指出,何时使用它而不是(说) return NULL; 要么 return nullptr;