This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] Add constexpr specifiers to std::shared_ptr, std::unique_ptr, etc


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]