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

Method ComputeIndex

Source/cmList.cxx:841–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

839}
840
841cmList::size_type cmList::ComputeIndex(index_type pos, bool boundCheck) const
842{
843 if (boundCheck) {
844 if (this->Values.empty()) {
845 throw std::out_of_range(
846 cmStrCat("index: ", pos, " out of range (0, 0)"));
847 }
848
849 auto index = pos;
850 if (!this->Values.empty()) {
851 auto length = this->Values.size();
852 if (index < 0) {
853 index = static_cast<index_type>(length) + index;
854 }
855 if (index < 0 || length <= static_cast<size_type>(index)) {
856 throw std::out_of_range(cmStrCat("index: ", pos, " out of range (-",
857 this->Values.size(), ", ",
858 this->Values.size() - 1, ')'));
859 }
860 }
861 return index;
862 }
863
864 return pos < 0 ? this->Values.size() + pos : pos;
865}
866cmList::size_type cmList::ComputeInsertIndex(index_type pos,
867 bool boundCheck) const
868{

Callers 2

get_itemMethod · 0.95
cmList.cxxFile · 0.80

Calls 3

cmStrCatFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected