title: Is it possible to force c++ class instantiation on the heap?
body: <p>I need to use this <code>class</code> in a threaded application so instantiating it on the stack will obviously be a problem, is there a way to force <code>new</code> to be used when instantiating the class?</p>
  
  <p>I have made the constructors <code>private</code> and the <code>new</code> operator public, something like</p>
  
  <pre><code>public:
      void *operator new(size_t);
  
  private:
      SomeClass(void);
      SomeClass(SomeType value); 
                 .
                 .
                 .
  </code></pre>
  
  <p>but as I expected when using</p>
  
  <pre><code>SomeClass *heapInstance = new SomeClass(value);
  </code></pre>
  
  <p>the compiler tells me that the constructor is private.</p>
  
  <p><strong>Question</strong>:</p>
  
  <ul>
  <li>Is there a solution to this?</li>
  </ul>
  
  <p><strong>Note</strong>: I have used this <code>class</code> all over the place, and now I need to fix my code, i.e. I need the compiler to prevent compilation so I don't need to manually search for each occurrence, I am not very good at c++ I just had to use it because I needed to do a GUI cross platform application and picked <code>Qt</code> for several reasons which are irrelevant here.</p>