MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / erase

Method erase

src/host/ui/buffer_model.h:122–127  ·  view source on GitHub ↗

Bounds-guarded erase: no-op if `i >= size()`. Erasing storage_[i] (a unique_ptr) never touches the addresses of surviving BufferRecords, so any Stage still holding a span into a surviving record's bytes stays valid. Callers that also own per-index Stage state must drop the Stage referencing the erased record *before* calling this, since the Stage's span becomes dangling once the record is destroye

Source from the content-addressed store, hash-verified

120 // the Stage referencing the erased record *before* calling this, since
121 // the Stage's span becomes dangling once the record is destroyed.
122 void erase(std::size_t i) {
123 if (i >= storage_.size()) {
124 return;
125 }
126 storage_.erase(storage_.begin() + static_cast<std::ptrdiff_t>(i));
127 }
128
129 private:
130 std::vector<std::unique_ptr<BufferRecord>> storage_;

Callers 4

removeMethod · 0.80
endMethod · 0.80
TESTFunction · 0.80

Calls 2

beginMethod · 0.80
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64