From 04946e0b64e5bafcfb01cca515f5abc34386e15c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 28 Nov 2021 16:53:57 +0000 Subject: Fix up all remaining warnings --- lib/cache.cpp | 1 + lib/cache.h | 5 +++++ lib/persistence.h | 2 ++ lib/special_members.hpp | 18 ++++++++++++++---- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 lib/cache.cpp (limited to 'lib') diff --git a/lib/cache.cpp b/lib/cache.cpp new file mode 100644 index 0000000..05b26b0 --- /dev/null +++ b/lib/cache.cpp @@ -0,0 +1 @@ +#include "cache.h" diff --git a/lib/cache.h b/lib/cache.h index 2a6e3e5..b081c04 100644 --- a/lib/cache.h +++ b/lib/cache.h @@ -1,14 +1,19 @@ #ifndef CACHE_H #define CACHE_H +#include "special_members.hpp" #include #include +#include template class Cache { public: using Ptr = std::shared_ptr; + Cache() = default; virtual ~Cache() = default; + DEFAULT_MOVE(Cache); + NO_COPY(Cache); [[nodiscard]] Ptr get(const std::string & key) diff --git a/lib/persistence.h b/lib/persistence.h index 5468cd3..60b40ca 100644 --- a/lib/persistence.h +++ b/lib/persistence.h @@ -107,7 +107,9 @@ namespace Persistence { struct Persistable; struct PersistenceStore { + PersistenceStore() = default; virtual ~PersistenceStore() = default; + DEFAULT_MOVE_NO_COPY(PersistenceStore); template [[nodiscard]] inline bool persistType(const T * const, const std::type_info & ti); diff --git a/lib/special_members.hpp b/lib/special_members.hpp index 0d63f58..d1dca99 100644 --- a/lib/special_members.hpp +++ b/lib/special_members.hpp @@ -9,10 +9,20 @@ TYPE(TYPE &&) = delete; \ void operator=(TYPE &&) = delete -#define DEFAULT_MOVE_COPY(TYPE) \ +#define DEFAULT_MOVE(TYPE) \ + TYPE(TYPE &&) noexcept = default; \ + TYPE & operator=(TYPE &&) noexcept = default + +#define DEFAULT_COPY(TYPE) \ TYPE(const TYPE &) = default; \ - TYPE(TYPE &&) = default; \ - TYPE & operator=(const TYPE &) = default; \ - TYPE & operator=(TYPE &&) = default + TYPE & operator=(const TYPE &) = default + +#define DEFAULT_MOVE_COPY(TYPE) \ + DEFAULT_MOVE(TYPE); \ + DEFAULT_COPY(TYPE) + +#define DEFAULT_MOVE_NO_COPY(TYPE) \ + DEFAULT_MOVE(TYPE); \ + NO_COPY(TYPE) #endif -- cgit v1.2.3