Is it possible, in ROOT5 or 6, to encapsulate every pointer to a TObject (or derived class) in a unique_ptr or shared_ptr? Alternatively, is there a way to use move semantics to avoid the complexities of pointers & ownership altogether?
The motivation: I want avoid memory leaks, which right now cause some of my code to seg fault, even though I use RAII techniques exclusively. Further, I really hope to avoid dealing with ROOT’s frustratingly arbitrary and complex object ownership rules. Move semantics is typically the simplest and best method, but it’s my understanding that there is no plan to allow that for TObjects, even with ROOT6. Nonetheless, I’ve found that the result of std::is_move_constructible::value is true in 5-34-18, assuming one hides the code from CINT and compiles it. With the same assumptions and ROOT6 beta, ::value is false.
A few pertinent details. I compile my code from within the interpreter, with .L MyCode.cc++. All of the code itself, save the declaration of the function I wish to call (from within the interpreter), is hidden from CINT w/ #if !defined(CINT) (and #endif) statements. (I’d be happy to avoid the interpreter altogether and write makefiles, if that happens to give me more flexibility.) The machine is running OSX 10.9.2 and Xcode 5.1.