NoS*_*tAl 5 static thread-safety c++11
想象一下,我有这个:
const string& get_name()
{
static auto* ptr_name=new string("Ron");
return *ptr_name;
}
Run Code Online (Sandbox Code Playgroud)
如果多个线程正在调用get_name是否是UB?
这在 C++11 及更高版本中是线程安全的。
VS-2013 尚未实现 C++11 的这一部分。VS-14 的作用: