scoped-ptr

Wrapping allocated output parameters with a scoped_ptr/array

So, I have some code which looks like this: byte* ar; foo(ar) // Allocates a new[] byte array for ar ... delete[] ar; To make this safer, I used a scoped_array: byte* arRaw; scoped_array<byte> ar; foo(arRaw); ar.reset(arRaw); ... // No delete[] The question is, Is there any existing way to do this using just the scoped_array, with...

Which non-shared Smart Pointer for class member variables

When I have a class that contains pointers as member variables what type of smart pointer should they have if I want don't want to use plain pointers? They do not need to be shared (so no shared_ptr necessary). scoped_ptr won't work since I often need to build the objects outside of the initialization list. Or is it maybe common practic...