ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.26k stars 393 forks source link

etl::unique_ptr reset #921

Closed fermentedfly closed 3 months ago

fermentedfly commented 4 months ago

Hi,

I have some cases where I need to clear (reset(nullptr)) the content of a uniqueptr which may or may not be already cleared. If it is already clear the assertion in `assert(p != p);is triggered. I was wondering if this should be the case since clearing what is already clear does seem fine to me. I propose the assertion to be changed toassert(p == nullptr || p != p);, or maybe implement the overloadedvoid reset( std::nullptr_t = nullptr )` What do you think?

Regards, Manuel

jwellbelove commented 4 months ago

Sounds reasonable

fermentedfly commented 4 months ago

Ok, do you want me to send you a PR?

fermentedfly commented 3 months ago

Thanks for implementing :)