From 4418f461108bbf5bc244b89444d3e872f9e4672e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Mon, 26 Feb 2024 15:46:34 +0100 Subject: [PATCH] Some fixes for noexcept specifications --- include/openPMD/backend/Attributable.hpp | 2 +- include/openPMD/backend/Container.hpp | 4 ++-- include/openPMD/snapshots/RandomAccessIterator.hpp | 7 +++++-- src/backend/Attributable.cpp | 2 +- src/snapshots/RandomAccessIterator.cpp | 9 +++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/openPMD/backend/Attributable.hpp b/include/openPMD/backend/Attributable.hpp index 499b9aea8e..bfb86cc188 100644 --- a/include/openPMD/backend/Attributable.hpp +++ b/include/openPMD/backend/Attributable.hpp @@ -119,7 +119,7 @@ class Attributable public: Attributable(); - Attributable(NoInit); + Attributable(NoInit) noexcept; virtual ~Attributable() = default; diff --git a/include/openPMD/backend/Container.hpp b/include/openPMD/backend/Container.hpp index 974b106549..629932ad57 100644 --- a/include/openPMD/backend/Container.hpp +++ b/include/openPMD/backend/Container.hpp @@ -489,7 +489,7 @@ OPENPMD_protected m_containerData = other.m_containerData; } - Container(Container &&other) : Attributable(NoInit()) + Container(Container &&other) noexcept : Attributable(NoInit()) { if (other.m_attri) { @@ -505,7 +505,7 @@ OPENPMD_protected return *this; } - Container &operator=(Container &&other) + Container &operator=(Container &&other) noexcept { if (other.m_attri) { diff --git a/include/openPMD/snapshots/RandomAccessIterator.hpp b/include/openPMD/snapshots/RandomAccessIterator.hpp index 5635bdeda6..a62c1f4ee4 100644 --- a/include/openPMD/snapshots/RandomAccessIterator.hpp +++ b/include/openPMD/snapshots/RandomAccessIterator.hpp @@ -56,10 +56,13 @@ class RandomAccessIterator ~RandomAccessIterator() override; RandomAccessIterator(RandomAccessIterator const &other); - RandomAccessIterator(RandomAccessIterator &&other) noexcept; + RandomAccessIterator(RandomAccessIterator &&other) noexcept( + noexcept(iterator_t(std::declval()))); RandomAccessIterator &operator=(RandomAccessIterator const &other); - RandomAccessIterator &operator=(RandomAccessIterator &&other) noexcept; + RandomAccessIterator & + operator=(RandomAccessIterator &&other) noexcept(noexcept( + std::declval().operator=(std::declval()))); value_type const &operator*() const; RandomAccessIterator &operator++(); diff --git a/src/backend/Attributable.cpp b/src/backend/Attributable.cpp index 357914d8b9..c1fb378f18 100644 --- a/src/backend/Attributable.cpp +++ b/src/backend/Attributable.cpp @@ -48,7 +48,7 @@ Attributable::Attributable() } } -Attributable::Attributable(NoInit) +Attributable::Attributable(NoInit) noexcept {} Attribute Attributable::getAttribute(std::string const &key) const diff --git a/src/snapshots/RandomAccessIterator.cpp b/src/snapshots/RandomAccessIterator.cpp index 506546ac41..d0248fecff 100644 --- a/src/snapshots/RandomAccessIterator.cpp +++ b/src/snapshots/RandomAccessIterator.cpp @@ -14,13 +14,18 @@ RandomAccessIterator::RandomAccessIterator( RandomAccessIterator const &other) = default; template RandomAccessIterator::RandomAccessIterator( - RandomAccessIterator &&other) noexcept = default; + RandomAccessIterator + &&other) noexcept(noexcept(iterator_t(std::declval()))) = + default; template RandomAccessIterator &RandomAccessIterator::operator=( RandomAccessIterator const &other) = default; template RandomAccessIterator &RandomAccessIterator::operator=( - RandomAccessIterator &&other) noexcept = default; + RandomAccessIterator + &&other) noexcept(noexcept(std::declval(). + operator=(std::declval()))) = + default; template auto RandomAccessIterator::operator*() const -> value_type const &