On 12/1/23 15:26, Andrey Semashev wrote:
On 12/1/23 11:32, Alexander Grund via Boost wrote:
And a possible bug I've just seen: template< typename R, typename D,...> explicit unique_resource_data(R&& res, D&& del)... : unique_resource_data(static_cast< R&& >(res), static_cast< D&& >(del), traits_type::is_allocated(static_cast< R&& >(res))) { }
The `static_cast
` look wrong. Should that be a std::move or std::forward? It is std::forward, but I had to check to be sure. (see above where a similar cast was a std::move) To me it looks like it`is_allocated` should not have a cast, should it? What if it is implemented to accept an instance, you castit to an rvalue, i.e. move it into that call and then use the moved-from value to construct `unique_resource_data` Similar for the deleter where using std::forward makes the intent clear. Thanks, I will take a look at that code. Quite possibly you're right, and I should avoid forwarding to is_allocated.
This should now be fixed on develop. Also, on the topic of using std::swap, I have changed the code to use boost::core::invoke_swap to swap bools, since I'm already using it to swap resources and deleters.