Verified Commit 79d7202a authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Add copy constructor and assignment operator for admire::adhoc_storage

parent a1b71cb2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -176,8 +176,11 @@ struct adhoc_storage : public storage {
                  bool should_flush);
    adhoc_storage(enum storage::type type, std::string id,
                  ADM_adhoc_context_t ctx);
    adhoc_storage(const adhoc_storage& other) noexcept;
    adhoc_storage(adhoc_storage&&) noexcept = default;
    adhoc_storage&
    operator=(const adhoc_storage&) noexcept;
    adhoc_storage&
    operator=(adhoc_storage&&) noexcept = default;
    ~adhoc_storage() override;

+10 −0
Original line number Diff line number Diff line
@@ -924,6 +924,16 @@ adhoc_storage::adhoc_storage(enum storage::type type, std::string id,
    : storage(type, std::move(id)),
      m_pimpl(std::make_unique<impl>(adhoc_storage::ctx{ctx})) {}

adhoc_storage::adhoc_storage(const adhoc_storage& other) noexcept
    : storage(other.m_type, other.m_id),
      m_pimpl(std::make_unique<impl>(*other.m_pimpl)) {}

adhoc_storage&
adhoc_storage::operator=(const adhoc_storage& other) noexcept {
    this->m_pimpl = std::make_unique<impl>(*other.m_pimpl);
    return *this;
}

std::shared_ptr<storage::ctx>
adhoc_storage::context() const {
    return std::make_shared<adhoc_storage::ctx>(m_pimpl->context());