MCPcopy Create free account
hub / github.com/Kitware/CMake / remove_self

Method remove_self

Source/cmFindBase.cxx:384–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382 bool valid() const { return count > 0 && !value.empty(); }
383
384 void remove_self(std::vector<std::string>& entries) const
385 {
386 if (this->valid()) {
387 long to_skip = this->count;
388 size_t index_to_remove = 0;
389 for (auto const& path : entries) {
390 if (path == this->value && --to_skip == 0) {
391 break;
392 }
393 ++index_to_remove;
394 }
395 if (index_to_remove < entries.size() && to_skip == 0) {
396 entries.erase(entries.begin() + index_to_remove);
397 }
398 }
399 }
400
401 long count = -1;
402 std::string value;

Callers 1

Calls 4

validMethod · 0.95
eraseMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected