Boost logo

Boost :

Subject: Re: [boost] smartptr maintained
From: Peter Dimov (lists_at_[hidden])
Date: 2016-05-18 11:51:59

Karolin Varner wrote:
> Hi,
> is smartptr still being maintained?
> There are four pull requests, one more than a year old.

Notes on

- you're using constexpr without checking whether it's supported; should be

- 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

- 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<Y const[]> p1( new Y[1] );
std::unique_ptr<Y> p2 = const_pointer_cast<Y>( std::move(p1) );
std::unique_ptr<Y[]> p3 = const_pointer_cast<Y[]>( 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at