openvdb icon indicating copy to clipboard operation
openvdb copied to clipboard

[REQUEST] AttributeWriteHandle::UniquePtr typedef

Open richhones opened this issue 4 years ago • 1 comments

The AttributeWriteHandle in AttributeArray.h has a typedef for a std::unique_ptr but it is ScopedPtr, not UniquePtr. Unfortunately as this is named differently to the AttributeHandle<Type>::UniquePtr it doesnt override that typedef (which the AttributeWriteHandle inherits from the AttributeHandle) so using AttributeWriteHandle<Type>::UniquePtr (which is valid) creates a AttributeHandle<Type>::UniquePtr (note: not a write handle). I imagine this is not intended as it is pretty confusing.

I think it would be better to rename the ScopedPtr typedef in the AttributeWriteHandle definition to UniquePtr (why was this different anyway?) or at least add a new UniquePtr typedef in AttributeWriteHandle for a unique ptr so that this doesn't happen.

Not a huge issue but just something I stumbled upon.

richhones avatar Mar 25 '21 18:03 richhones

Yes, this was written pre-C++11 as it used boost::scoped_ptr instead of std::unique_ptr. We can actually deprecate alias declarations, so we should probably mark ScopedPtr as deprecated and add UniquePtr. That seems best to me, I agree this is worth resolving.

danrbailey avatar Mar 25 '21 19:03 danrbailey