value_ptr — The Missing C++ Smart-pointer
Buckaroo - C/C++ Package Manager
305

Hi!

I’m author of “PImpl, Rule of Zero and Scott Meyers”.

impl_ptr described in mine article (https://github.com/oliora/samples/blob/master/spimpl.h) has the same behavior as value_ptr (owning of heap allocated object and cloning it on copy) and can be used instead of impl_ptr. Despite of the same behavior, I think that concept of value_ptr is more universal (thus better) than one of impl_ptr. The name is better as well!

That’s why it would be great if value_ptr get a solid implementation that is on par with a great idea behind it. If you allow, I’d like to propose the following changes to value_ptr:

  • Use compressed_pair<unique_ptr<T>, Cloner> instead of two separate members to save some space in case of stateless cloner.
  • Look at impl_ptr interface and steal it to make value_ptr safer and more like an STL smart pointers.
  • Allow to specialize Deleter (take a look at impl_ptr again).

All the best!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.