[glibmm] Boxed types: Declare move operations as noexcept.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Boxed types: Declare move operations as noexcept.
- Date: Thu, 20 Aug 2015 10:21:11 +0000 (UTC)
commit c18212e3a4f10f449c4868e4db2fd46f95871812
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Aug 15 13:59:45 2015 +0200
Boxed types: Declare move operations as noexcept.
Because this can let standard containers more efficiently reallocate
memory while still preserving their own noexcept guarantees.
I found out about this in Scott Meyer's Effective Modern C++11:
Item 14.
Likewise make swap() noexcept because we use it in our noexcept
move assignment operator.
tools/m4/class_boxedtype.m4 | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/tools/m4/class_boxedtype.m4 b/tools/m4/class_boxedtype.m4
index 1afa53a..3df7f69 100644
--- a/tools/m4/class_boxedtype.m4
+++ b/tools/m4/class_boxedtype.m4
@@ -135,14 +135,14 @@ __CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other)
gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : 0)
{}
-__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other)
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
:
gobject_(other.gobject_)
{
other.gobject_ = nullptr;
}
-__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other)
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
{
__CPPNAME__ temp (other);
swap(temp);
@@ -173,7 +173,7 @@ dnl This could be a free or an unref, we do not need to know.
__BOXEDTYPE_FUNC_FREE`'(gobject_);
}
-void __CPPNAME__::swap(__CPPNAME__& other)
+void __CPPNAME__::swap(__CPPNAME__& other) noexcept
{
__CNAME__ *const temp = gobject_;
gobject_ = other.gobject_;
@@ -222,13 +222,13 @@ ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
__CPPNAME__`'(const __CPPNAME__& other);
__CPPNAME__& operator=(const __CPPNAME__& other);
- __CPPNAME__`'(__CPPNAME__&& other);
- __CPPNAME__& operator=(__CPPNAME__&& other);
+ __CPPNAME__`'(__CPPNAME__&& other) noexcept;
+ __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
_IMPORT(SECTION_DTOR_DOCUMENTATION)
~__CPPNAME__`'();
- void swap(__CPPNAME__& other);
+ void swap(__CPPNAME__& other) noexcept;
///Provides access to the underlying C instance.
__CNAME__* gobj() { return gobject_; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]