expected-lite icon indicating copy to clipboard operation
expected-lite copied to clipboard

Use ``std::addressof`` instead of plain ``operator &``

Open DNKpp opened this issue 4 months ago • 0 comments

I find myself often working with some COM-like types, which I would like to wrap inside an expected. Unfortunately, some of those types have an overloaded operator & which perform a cleanup (don't ask why...). In fact, this constantly crashes, because expected-lite performs a placement-new and requests the address via operator & which then leads to a cleanup of unitialized ptrs. image

I think, using std::addressof instead of the plain operator & should help here.

DNKpp avatar Oct 17 '24 18:10 DNKpp