It seems that shared_ptr::use_count() does
not include weak_ptr instances. Therefore
shared_ptr::use_count()==1 (aka unique())
does *not* ensure exclusive ownership!
This breaks the assumption used by
shared_vector::make_unique() to avoid
allocating a new array in some cases.
pass values by reference where appropriate.
When reallocating arrays of shared_ptr
"move" with swap() instead of operator=
to avoid ref counter inc and dec for each
element.
Shared ownership of a single C array.
Tracks offset and length for each instance
allowing each owner to "view" a different
piece of the array.
Parts of shared_vector<T> which can work
for T=void are in shared_vector_base<T>.
Specializations shared_vector<void>
and shared_vector<const void> handle
un-typed arrays.
Allow casting to/from typed vector
Offsets and sizes of untyped vectors are tracked in
bytes. Therefore casting to types where sizeof(T)>1
is undefined if the offset is not a multiple of
sizeof(T).