mirror of
https://github.com/Z3Prover/z3
synced 2025-08-20 02:00:22 +00:00
buffer: require a move constructor to avoid copies
remove unneded copy constructors from several classes
This commit is contained in:
parent
3d98bccc33
commit
98b5abb1d4
16 changed files with 38 additions and 50 deletions
|
@ -228,6 +228,7 @@ interval::interval(v_dependency_manager & m, rational const & val, bool open, bo
|
|||
}
|
||||
|
||||
interval & interval::operator=(interval const & other) {
|
||||
SASSERT(&m == &other.m);
|
||||
m_lower = other.m_lower;
|
||||
m_upper = other.m_upper;
|
||||
m_lower_open = other.m_lower_open;
|
||||
|
@ -237,6 +238,17 @@ interval & interval::operator=(interval const & other) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
interval & interval::operator=(interval && other) {
|
||||
SASSERT(&m == &other.m);
|
||||
m_lower = std::move(other.m_lower);
|
||||
m_upper = std::move(other.m_upper);
|
||||
m_lower_open = other.m_lower_open;
|
||||
m_upper_open = other.m_upper_open;
|
||||
m_lower_dep = other.m_lower_dep;
|
||||
m_upper_dep = other.m_upper_dep;
|
||||
return *this;
|
||||
}
|
||||
|
||||
interval & interval::operator+=(interval const & other) {
|
||||
m_lower += other.m_lower;
|
||||
m_upper += other.m_upper;
|
||||
|
|
|
@ -16,8 +16,7 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef OLD_INTERVAL_H_
|
||||
#define OLD_INTERVAL_H_
|
||||
#pragma once
|
||||
|
||||
#include "util/rational.h"
|
||||
#include "util/dependency.h"
|
||||
|
@ -81,6 +80,8 @@ public:
|
|||
explicit old_interval(v_dependency_manager & m, rational const & val, v_dependency * l_dep = nullptr, v_dependency * u_dep = nullptr);
|
||||
explicit old_interval(v_dependency_manager & m, rational const & val, bool open, bool lower, v_dependency * d);
|
||||
explicit old_interval(v_dependency_manager & m, ext_numeral const& lower, bool l_open, v_dependency * l_dep, ext_numeral const & upper, bool u_open, v_dependency * u_dep);
|
||||
old_interval(const old_interval&) = default;
|
||||
old_interval(old_interval&&) = default;
|
||||
|
||||
bool minus_infinity() const { return m_lower.is_infinite(); }
|
||||
bool plus_infinity() const { return m_upper.is_infinite(); }
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
rational const & get_lower_value() const { SASSERT(!minus_infinity()); return m_lower.to_rational(); }
|
||||
rational const & get_upper_value() const { SASSERT(!plus_infinity()); return m_upper.to_rational(); }
|
||||
old_interval & operator=(old_interval const & other);
|
||||
old_interval & operator=(old_interval && other);
|
||||
old_interval & operator+=(old_interval const & other);
|
||||
old_interval & operator-=(old_interval const & other);
|
||||
old_interval & operator*=(old_interval const & other);
|
||||
|
@ -125,12 +127,5 @@ inline old_interval operator/(old_interval const & i1, old_interval const & i2)
|
|||
inline old_interval expt(old_interval const & i, unsigned n) { old_interval tmp(i); tmp.expt(n); return tmp; }
|
||||
inline std::ostream & operator<<(std::ostream & out, old_interval const & i) { i.display(out); return out; }
|
||||
|
||||
struct interval_detail{};
|
||||
inline std::pair<old_interval, interval_detail> wd(old_interval const & i) { interval_detail d; return std::make_pair(i, d); }
|
||||
inline std::ostream & operator<<(std::ostream & out, std::pair<old_interval, interval_detail> const & p) { p.first.display_with_dependencies(out); return out; }
|
||||
|
||||
// allow "customers" of this file to keep using interval
|
||||
#define interval old_interval
|
||||
|
||||
#endif /* OLD_INTERVAL_H_ */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue