More consistently delete or default move/copy constructor/assignment.

This commit is contained in:
levlam 2023-05-05 14:31:55 +03:00
parent dbcf3e5eec
commit 018f8022f7
4 changed files with 10 additions and 4 deletions

View File

@ -223,10 +223,10 @@ class JsonScope {
CHECK(is_active()); CHECK(is_active());
} }
JsonScope(const JsonScope &) = delete; JsonScope(const JsonScope &) = delete;
JsonScope &operator=(const JsonScope &) = delete;
JsonScope(JsonScope &&other) noexcept : sb_(other.sb_), jb_(other.jb_), save_scope_(other.save_scope_) { JsonScope(JsonScope &&other) noexcept : sb_(other.sb_), jb_(other.jb_), save_scope_(other.save_scope_) {
other.jb_ = nullptr; other.jb_ = nullptr;
} }
JsonScope &operator=(const JsonScope &) = delete;
JsonScope &operator=(JsonScope &&) = delete; JsonScope &operator=(JsonScope &&) = delete;
~JsonScope() { ~JsonScope() {
if (jb_) { if (jb_) {
@ -342,7 +342,10 @@ class JsonArrayScope final : public JsonScope {
jb->inc_offset(); jb->inc_offset();
*sb_ << "["; *sb_ << "[";
} }
JsonArrayScope(const JsonArrayScope &) = delete;
JsonArrayScope &operator=(const JsonArrayScope &) = delete;
JsonArrayScope(JsonArrayScope &&) = default; JsonArrayScope(JsonArrayScope &&) = default;
JsonArrayScope &operator=(JsonArrayScope &&) = delete;
~JsonArrayScope() { ~JsonArrayScope() {
if (jb_) { if (jb_) {
leave(); leave();
@ -383,7 +386,10 @@ class JsonObjectScope final : public JsonScope {
jb->inc_offset(); jb->inc_offset();
*sb_ << "{"; *sb_ << "{";
} }
JsonObjectScope(const JsonObjectScope &) = delete;
JsonObjectScope &operator=(const JsonObjectScope &) = delete;
JsonObjectScope(JsonObjectScope &&) = default; JsonObjectScope(JsonObjectScope &&) = default;
JsonObjectScope &operator=(JsonObjectScope &&) = delete;
~JsonObjectScope() { ~JsonObjectScope() {
if (jb_) { if (jb_) {
leave(); leave();

View File

@ -110,7 +110,7 @@ struct MapNode<KeyT, ValueT, typename std::enable_if_t<(sizeof(KeyT) + sizeof(Va
Impl(const Impl &) = delete; Impl(const Impl &) = delete;
Impl &operator=(const Impl &) = delete; Impl &operator=(const Impl &) = delete;
Impl(Impl &&) = delete; Impl(Impl &&) = delete;
void operator=(Impl &&) = delete; Impl &operator=(Impl &&) = delete;
~Impl() { ~Impl() {
second.~ValueT(); second.~ValueT();
} }

View File

@ -81,7 +81,7 @@ struct SetNode<KeyT, typename std::enable_if_t<(sizeof(KeyT) > 28 * sizeof(void
Impl(const Impl &) = delete; Impl(const Impl &) = delete;
Impl &operator=(const Impl &) = delete; Impl &operator=(const Impl &) = delete;
Impl(Impl &&) = delete; Impl(Impl &&) = delete;
void operator=(Impl &&) = delete; Impl &operator=(Impl &&) = delete;
}; };
using public_key_type = KeyT; using public_key_type = KeyT;

View File

@ -38,7 +38,7 @@ class MemoryMapping {
MutableSlice as_mutable_slice(); // returns empty slice if memory is read-only MutableSlice as_mutable_slice(); // returns empty slice if memory is read-only
MemoryMapping(const MemoryMapping &) = delete; MemoryMapping(const MemoryMapping &) = delete;
const MemoryMapping &operator=(const MemoryMapping &) = delete; MemoryMapping &operator=(const MemoryMapping &) = delete;
MemoryMapping(MemoryMapping &&other) noexcept; MemoryMapping(MemoryMapping &&other) noexcept;
MemoryMapping &operator=(MemoryMapping &&other) noexcept; MemoryMapping &operator=(MemoryMapping &&other) noexcept;
~MemoryMapping(); ~MemoryMapping();