You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current code there is no implementation for swap() which means std::swap() will be used. This should do the right thing (as long as the move constructor and move assignment do the right thing) and the tests show this.
But this solution is not optimal, because the default std::swap() will always do one move construction and two move assignments (in this case of the variant). If there is a more efficient swap for the type in the variant, it will not be used. The upcoming standard P0088R0 describes the effects of swap as: "if index() == rhs.index(), calls swap(get<i>(*this), get<i>(hrs)) with i being index(). Else calls swap(*this, hrs)."
We might want to implement our own swap in the future.
The text was updated successfully, but these errors were encountered:
In the current code there is no implementation for
swap()
which meansstd::swap()
will be used. This should do the right thing (as long as the move constructor and move assignment do the right thing) and the tests show this.But this solution is not optimal, because the default
std::swap()
will always do one move construction and two move assignments (in this case of the variant). If there is a more efficientswap
for the type in the variant, it will not be used. The upcoming standard P0088R0 describes the effects of swap as: "ifindex() == rhs.index()
, callsswap(get<i>(*this), get<i>(hrs))
withi
beingindex()
. Else callsswap(*this, hrs)
."We might want to implement our own
swap
in the future.The text was updated successfully, but these errors were encountered: