summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cache.cpp1
-rw-r--r--lib/cache.h5
-rw-r--r--lib/persistence.h2
-rw-r--r--lib/special_members.hpp18
4 files changed, 22 insertions, 4 deletions
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 <map>
#include <memory>
+#include <string>
template<typename Obj> class Cache {
public:
using Ptr = std::shared_ptr<Obj>;
+ 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<typename T> [[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