mirror of
https://github.com/Z3Prover/z3
synced 2026-02-10 02:50:55 +00:00
Add move semantics to z3::context class
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
9ea37793af
commit
6e09a06307
3 changed files with 179 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