From 79bf6e56972398a239aee558bc8ca6208deb2b64 Mon Sep 17 00:00:00 2001 From: Teebonne <80053070+Teebonne@users.noreply.github.com> Date: Sat, 15 Oct 2022 16:54:42 +0100 Subject: [PATCH 1/2] Marking constructors as noexcept See https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c44-prefer-default-constructors-to-be-simple-and-non-throwing --- include/cereal/cereal.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/cereal/cereal.hpp b/include/cereal/cereal.hpp index 764380bf..ef1a44e3 100644 --- a/include/cereal/cereal.hpp +++ b/include/cereal/cereal.hpp @@ -320,7 +320,7 @@ namespace cereal public: //! Construct the output archive /*! @param derived A pointer to the derived ArchiveType (pass this from the derived archive) */ - OutputArchive(ArchiveType * const derived) : self(derived), itsCurrentPointerId(1), itsCurrentPolymorphicTypeId(1) + OutputArchive(ArchiveType * const derived) CEREAL_NOEXCEPT : self(derived), itsCurrentPointerId(1), itsCurrentPolymorphicTypeId(1) { } OutputArchive & operator=( OutputArchive const & ) = delete; @@ -712,7 +712,7 @@ namespace cereal public: //! Construct the output archive /*! @param derived A pointer to the derived ArchiveType (pass this from the derived archive) */ - InputArchive(ArchiveType * const derived) : + InputArchive(ArchiveType * const derived) CEREAL_NOEXCEPT : self(derived), itsBaseClassSet(), itsSharedPointerMap(), From e1d4e2a870c11a2f5098cffd5feb20e19d8ee376 Mon Sep 17 00:00:00 2001 From: Teebonne <80053070+Teebonne@users.noreply.github.com> Date: Sat, 15 Oct 2022 17:18:07 +0100 Subject: [PATCH 2/2] Marking constructors as noexcept --- include/cereal/archives/binary.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/cereal/archives/binary.hpp b/include/cereal/archives/binary.hpp index 0bded011..1d634765 100644 --- a/include/cereal/archives/binary.hpp +++ b/include/cereal/archives/binary.hpp @@ -54,7 +54,7 @@ namespace cereal //! Construct, outputting to the provided stream /*! @param stream The stream to output to. Can be a stringstream, a file stream, or even cout! */ - BinaryOutputArchive(std::ostream & stream) : + BinaryOutputArchive(std::ostream & stream) CEREAL_NOEXCEPT : OutputArchive(this), itsStream(stream) { } @@ -89,7 +89,7 @@ namespace cereal { public: //! Construct, loading from the provided stream - BinaryInputArchive(std::istream & stream) : + BinaryInputArchive(std::istream & stream) CEREAL_NOEXCEPT : InputArchive(this), itsStream(stream) { }