mirror of
https://github.com/Z3Prover/z3
synced 2026-02-09 10:35:36 +00:00
Merge pull request #8508 from Z3Prover/copilot/add-move-constructor-z3-context
Add move semantics to z3::context
This commit is contained in:
commit
7d6c809f28
1 changed files with 18 additions and 0 deletions
|
|
@ -214,6 +214,24 @@ namespace z3 {
|
|||
public:
|
||||
context() { config c; init(c); }
|
||||
context(config & c) { init(c); }
|
||||
|
||||
context(context && other) noexcept
|
||||
: m_enable_exceptions(other.m_enable_exceptions),
|
||||
m_rounding_mode(other.m_rounding_mode),
|
||||
m_ctx(other.m_ctx) {
|
||||
other.m_ctx = nullptr;
|
||||
}
|
||||
|
||||
context & operator=(context && other) noexcept {
|
||||
if (this != &other) {
|
||||
if (m_ctx) Z3_del_context(m_ctx);
|
||||
m_enable_exceptions = other.m_enable_exceptions;
|
||||
m_rounding_mode = other.m_rounding_mode;
|
||||
m_ctx = other.m_ctx;
|
||||
other.m_ctx = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
~context() { if (m_ctx) Z3_del_context(m_ctx); }
|
||||
operator Z3_context() const { return m_ctx; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue