title: How to define threadprivate variables for class member variables
body: <p>I'm writing a multi-threaded object oriented c++ code via OpenMP. For the sake of simplicity and generality I'm obliged to define some of my variables and functions in a template class. I want to make them <code>threadprivate</code> to exploit the persistence features of thread-private variables and be able to use them in other functions or source files embedded in or calling the template class. but I receive the following error:
  "<strong>... is not file, namespace, or block scope variable</strong>"
  I know that I can only use <code>threadprivate</code> directive for file, namespace, or block scope variables but I was wondering if there's any alternative to apply <code>threadprivate</code> directive for class members too. My total code layout is like:</p>
  
  <pre><code>template&lt;typename T&gt; class EntContainer
  {
  private:
  T** empties;
  e_NumPointers;
  e_nLists;
  .
  .
  .
  public:
  #pragma omp threadprivate(empties, e_NumPointers, e_nLists)
  void function
  {
  // do some paralle stuff using #pragma omp parallel 
  }
  }
  </code></pre>
  
  <p>Thanks in advance</p>