[PATCH] Mark move constructors as "noexcept"
Tom Tromey
tromey@adacore.com
Mon Apr 20 17:44:58 GMT 2020
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
Tom> I recently learned that move constructors generally should be marked
Tom> "noexcept". This ensures that standard containers will move objects
Tom> when possible, rather than copy them.
Tom> This patch fixes the cases I could find. Note that implicitly-defined
Tom> or defaulted move constructors will automatically do what you'd
Tom> expect; that is, they are noexcept if all the members have noexcept
Tom> move constructors.
Tom> While doing this, I noticed a couple of odd cases where the move
Tom> constructor seemed to assume that the object being constructed could
Tom> have state requiring destruction. I've fixed these as well. See
Tom> completion_result and scoped_mmap.
I'm checking this in.
Tom
More information about the Gdb-patches
mailing list