3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-08 12:11:23 +00:00

remove a bunch of constructors to avoid copies

still not enough to guarantee that vector::expand doesnt copy (WIP)
This commit is contained in:
Nuno Lopes 2020-06-03 17:09:27 +01:00
parent 98b5abb1d4
commit 7ac2791482
16 changed files with 66 additions and 83 deletions

View file

@ -18,8 +18,7 @@ Revision History:
--*/
#ifndef OPTIONAL_H_
#define OPTIONAL_H_
#pragma once
template<class T>
class optional {
@ -47,6 +46,11 @@ public:
construct(val);
}
optional(T && val) noexcept : m_obj(nullptr), m_initialized(0) {
std::swap(m_obj, val.m_obj);
std::swap(m_initialized, val.m_initialized);
}
optional(const optional<T> & val):
m_initialized(0) {
if (val.m_initialized == 1) {
@ -160,7 +164,3 @@ public:
T * & operator*() { return m_ptr; }
};
#endif /* OPTIONAL_H_ */