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