27 Jun
2019
27 Jun
'19
3:16 p.m.
On 6/26/19 11:45 PM, degski via Boost wrote:
On Thu, 27 Jun 2019 at 09:35, Robert Ramey via Boost
wrote: From time to time I think about this. Is swap guarenteed not to throw?
As from C++11 std::swap is marked noexcept, so yes. As from C++20 it's also constexpr, so now it can definitely cannot throw.
Hmmm - my understanding of noexcept was not that it couldn't throw but than any attempt to throw would result in immediate termination rather than an exception. (I'm confused about noexcept as well). In anycase I should have phrased the above as: Is swap guaranteed to succeed? Robert Ramey