Karolin Varner wrote:
Hi,
is smartptr still being maintained?
There are four pull requests, one more than a year old.
Notes on https://github.com/boostorg/smart_ptr/pull/23:
- you're using constexpr without checking whether it's supported; should be
BOOST_CONSTEXPR.
- ditto for static_assert.
- since you're adding new functionality, the existing test
(pointer_cast_test.cpp) should be left alone, and new tests should be added
instead.
- the test uses lambdas without checking whether they're supported.
- the unique_ptr casts do not seem to properly account for T or U being X cv
[]. So for example in
std::unique_ptr p1( new Y[1] );
std::unique_ptr<Y> p2 = const_pointer_cast<Y>( std::move(p1) );
std::unique_ptr p3 = const_pointer_cast( std::move(p1) );
the second line compiles and the third doesn't, when the opposite should be
the case.
- there should be tests that make sure that the legal unique_ptr conversions
compile and that the illegal ones do not.
- there should be tests that check that the existing static_assert guard
actually prevents illegal derived to base conversions from compiling.
- it seems a bit odd to disallow static_cast'ing from derived to base with
base lacking a virtual destructor and yet allow base to derived.
I find the static_assert check is a bit odd here, actually, given that
unique_ptr<derived> is convertible to unique_ptr<base>. We're in a way being
more Catholic than the pope here.