ETLCPP / etl

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

etl::unique_ptr reset #921

Closed fermentedfly closed 3 weeks ago

fermentedfly commented 1 month 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 1 month ago

Sounds reasonable

fermentedfly commented 1 month ago

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

fermentedfly commented 3 weeks ago

Thanks for implementing :)