MCPcopy Create free account
hub / github.com/Snapchat/Valdi / erase

Method erase

valdi_protobuf/src/valdi_protobuf/FieldMap.cpp:99–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99bool FieldMap::erase(FieldNumber i) {
100 if (VALDI_UNLIKELY(_isMap)) {
101 auto& map = getMap();
102 auto it = map.find(i);
103 if (it == map.end()) {
104 return false;
105 }
106 map.erase(it);
107 return true;
108 } else {
109 auto& vec = getVec();
110 if (i >= vec.size()) {
111 return false;
112 }
113 auto& item = vec[i];
114 if (item.isUnset()) {
115 return false;
116 }
117 item = Field();
118 return true;
119 }
120}
121
122Field* FieldMap::find(FieldNumber i) {
123 if (VALDI_UNLIKELY(_isMap)) {

Callers 1

clearFieldMethod · 0.45

Calls 5

isUnsetMethod · 0.80
FieldClass · 0.70
endMethod · 0.65
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected