Mir

Code review comment for lp:~cemil-azizoglu/mir/improve-raii

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

> 348 + release_fn(std::move(other.release_fn))
> 367 + if (release_fn)
>
> Unfortunately the standard says that move-constructing a std::function from
> another std::function leaves the latter in a valid but unspecified state. So
> "if (release_fn)" in the destructor is not guaranteed to be false after the
> move.

That's so weird. I guess you could use other.swap(release_fn) in the constructor body instead. I hope that's well defined :)

« Back to merge proposal