[v3] Add constexpr specifiers to std::shared_ptr, std::unique_ptr, etc
Jonathan Wakely
jwakely.gcc@gmail.com
Sat Nov 6 16:48:00 GMT 2010
We still have a regression in this program:
void del(int*);
std::unique_ptr<int, void(*)(int*)> p(new int, del);
I was going to fix it when adding constexpr, which is now done, but I
won't be able to do it before Monday.
I'm not sure what's the best way to allow that, but make the following
ill-formed as required:
std::unique_ptr<int, void(*)(int*)> p(new int);
I was thinking about using a non-default-constructible class to hold
the deleter when it's a pointer type and making unique_ptr::_M_t have
type
tuple<_Tp,
typename conditional<is_pointer<_Dp>::value,
not_null<_Dp>, _Dp>::type>
so that the unique_ptr constructors which value-initialize the deleter
will be ill-formed. That should work for the constexpr constructors,
unlike a static_assert in the ctor body.
Better suggestions are welcome.
More information about the Libstdc++
mailing list