mirror of
https://github.com/Z3Prover/z3
synced 2026-02-02 15:26:17 +00:00
[WIP] Update code base to use std::span (#8269)
* Initial plan * Add std::span to bit_util.h with backward compatibility Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Add std::span to hash.h unsigned_ptr_hash function Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Add std::span to ref_vector.h append and constructor Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
1bb471447e
commit
7686e861a8
5 changed files with 192 additions and 106 deletions
|
|
@ -18,6 +18,7 @@ Revision History:
|
|||
--*/
|
||||
#pragma once
|
||||
|
||||
#include<span>
|
||||
#include "util/vector.h"
|
||||
#include "util/obj_ref.h"
|
||||
#include "util/ref.h"
|
||||
|
|
@ -192,9 +193,14 @@ public:
|
|||
push_back(other[i]);
|
||||
}
|
||||
|
||||
void append(std::span<T * const> data) {
|
||||
for(auto elem : data)
|
||||
push_back(elem);
|
||||
}
|
||||
|
||||
// Backward compatibility overload
|
||||
void append(unsigned sz, T * const * data) {
|
||||
for(unsigned i = 0; i < sz; ++i)
|
||||
push_back(data[i]);
|
||||
append(std::span<T * const>(data, sz));
|
||||
}
|
||||
|
||||
void operator=(ref_vector_core && other) noexcept {
|
||||
|
|
@ -249,9 +255,15 @@ public:
|
|||
|
||||
ref_vector(ref_vector &&) noexcept = default;
|
||||
|
||||
ref_vector(TManager & m, std::span<T * const> data):
|
||||
super(ref_manager_wrapper<T, TManager>(m)) {
|
||||
this->append(data);
|
||||
}
|
||||
|
||||
// Backward compatibility overload
|
||||
ref_vector(TManager & m, unsigned sz, T * const * data):
|
||||
super(ref_manager_wrapper<T, TManager>(m)) {
|
||||
this->append(sz, data);
|
||||
this->append(std::span<T * const>(data, sz));
|
||||
}
|
||||
|
||||
TManager & get_manager() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue