Using the OpenMP threadprivate directive on static instances of C++ STL types

前端 未结 3 1668
星月不相逢
星月不相逢 2021-01-18 09:22

Consider the following snippet:

#include 

class A {
    static std::map theMap;
#pragma omp threadprivate(theMap)
};

std::map<         


        
3条回答
  •  青春惊慌失措
    2021-01-18 10:12

    The incomplete type error is a bug in the compiler which can be worked around by instantiating std::map before the threadprivate directive. But once you get past that issue GCC 4.7 still doesn't support dynamic initialization of threadprivate variables. This will be supported in GCC 4.8.

提交回复
热议问题