Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 增强C++;线程本地存储向量_C++_Multithreading_Boost_Vector_Thread Local Storage - Fatal编程技术网

C++ 增强C++;线程本地存储向量

C++ 增强C++;线程本地存储向量,c++,multithreading,boost,vector,thread-local-storage,C++,Multithreading,Boost,Vector,Thread Local Storage,我正在为多线程创建一个tls向量,我想知道如何访问向量元素 基本上,我创建了: static boost::thread_specific_ptr< std::string > temp_str; static boost::thread_specific_ptr< std::vector< std::string > > _Vector_; 有什么建议吗? 谢谢:)这不是问题的原因,但标识符\u Vector\u是保留的。每个名称包含一个双下划线(u)或

我正在为多线程创建一个tls向量,我想知道如何访问向量元素

基本上,我创建了:

static boost::thread_specific_ptr< std::string > temp_str;
static boost::thread_specific_ptr< std::vector< std::string > > _Vector_;

有什么建议吗?
谢谢:)

这不是问题的原因,但标识符
\u Vector\u
是保留的。每个名称包含一个双下划线(u)或以下划线开头,后跟一个大写字母(2.11)的,都保留给实现以供任何使用。每个以下划线开头的名称都保留给实现,以用作全局命名空间中的名称。有趣的是…不知道这一点。另外,我想出了一个解决方案,那就是使用at()方法。So:Vector->get().at(i)
void myFunc()
{

//I need to assign _Vector[i]_ to temp_str
*temp_str = _Vector_.get()[i]; //I know this is an error

}