title: What can I use as a standard c++ base class for RAII+seperatio of concerns purposes
body: <p>I am looking to expose a class which implements RAII purpose and toggles some global state. For all intents and purposes the class implementation should be hidden. In other words, the class declaration looks like this:</p>
  
  <pre><code>class ScopedToggleSomething {
  public:
      ScopedToggleSomething();
      ~ScopedToggleSomething();
  };
  </code></pre>
  
  <p>and it will be used as such:</p>
  
  <pre><code>ScopedToggleSomething localToggle;
  </code></pre>
  
  <p>this is fine, but it's verbose. If there was some standard base class with virtual constructor/destructor, I could have made declaration much simpler, such as:</p>
  
  <pre><code>std::unique_ptr&lt;std::object&gt; ScopedToggleSomethingFactory();
  </code></pre>
  
  <p>and use it like so:</p>
  
  <pre><code>auto localToggle = ScopedToggleSomethingFactory();
  </code></pre>
  
  <p>and that allows me to hide even a class declaration. <code>std::object</code> doesn't exist obviously, it's just to make a point. My question is, whether there is some standard base class that would allow me to implement such pattern and avoid unneeded verbosity in header. <code>boost::noncopyable</code> comes to mind, but it has no virtual destructor, so won't work.</p>
  
  <p><em>EDIT</em>: I guess I was not clear that what I was looking is not only RIAA, but also "hide" the actual implementation of functionality outside the header, and only declare bare minimum necessary to use the class</p>