{ swap(l.t1,r.t1); swap(l.t2,r.t2); } 和第二次交换抛出,然后你有一半交换对象的。 问候 DS I think that the restriction must apply regardless to whether it ismember or not. consider struct A{T1 t1_;T2 t2_;}; void swap(A & l, A & r){swap(l.t1, r.t1);swap(l.t2, r.t2);} and second swap throws, then you havehalf swapped objects. regards DS 但是替代方案是什么?抑制任何错误并且在没有机会知道的情况下有一个错误的状态? But what is the alternative? Suppressing any errors and have anerroneous state without a chance of knowing? 这篇关于成员“交换”的原因功能不应该扔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-16 21:33