#pragma once #include namespace detail { template > struct MoveOrCopyIfThrow; template struct MoveOrCopyIfThrow { void operator()(T && src, T & dst) const { dst = std::forward(src); } }; template struct MoveOrCopyIfThrow { void operator()(T && src, T & dst) const { dst = src; } }; template void moveOrCopyIfThrow(T && src, T & dst) { MoveOrCopyIfThrow()(std::forward(src), dst); } }