<分区>
我在我的 C++ 类 thread_local unsigned int counter_ = 0;
的私有(private)部分声明了一个 thread_local 并且我一直收到错误“为 counter_ 指定的存储类”
<分区>
我在我的 C++ 类 thread_local unsigned int counter_ = 0;
的私有(private)部分声明了一个 thread_local 并且我一直收到错误“为 counter_ 指定的存储类”
最佳答案
来自 C++ 17 标准 *12.2 类成员)
9 A member shall not be declared with the extern storage-class-specifier. Within a class definition, a member shall not be declared with the thread_local storage-class-specifier unless also declared static.
关于c++ - thread_local "storage class specified",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59275011/