3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 20:05:51 +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

@ -16,8 +16,7 @@ Author:
Revision History:
--*/
#ifndef REF_VECTOR_H_
#define REF_VECTOR_H_
#pragma once
#include "util/vector.h"
#include "util/obj_ref.h"
@ -49,11 +48,14 @@ protected:
public:
typedef T * data;
ref_vector_core(Ref const & r = Ref()):Ref(r) {}
ref_vector_core() = default;
ref_vector_core(Ref const & r) : Ref(r) {}
ref_vector_core(ref_vector_core && other) :
Ref(std::move(other)),
m_nodes(std::move(other.m_nodes)) {}
ref_vector_core(const ref_vector_core & other) {
append(other);
}
ref_vector_core(ref_vector_core &&) = default;
~ref_vector_core() {
dec_range_ref(m_nodes.begin(), m_nodes.end());
@ -400,9 +402,8 @@ public:
/**
\brief Vector of unmanaged references.
*/
template<typename T>
class sref_vector : public ref_vector_core<T, ref_unmanaged_wrapper<T> > {
};
template<typename T>
using sref_vector = ref_vector_core<T, ref_unmanaged_wrapper<T>>;
/**
\brief Hash utilities on ref_vector pointers.
@ -440,6 +441,3 @@ struct ref_vector_ptr_eq {
return true;
}
};
#endif /* REF_VECTOR_H_ */