MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / removeAll

Function removeAll

Libraries/Containers/Array.h:93–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 /// @see Algorithms::removeIf
92 template <typename Lambda>
93 [[nodiscard]] bool removeAll(Lambda&& criteria)
94 {
95 T* itBeg = Parent::begin();
96 T* itEnd = Parent::end();
97 T* it = Algorithms::removeIf(itBeg, itEnd, forward<Lambda>(criteria));
98
99 const size_t numBytes = static_cast<size_t>(itEnd - it) * sizeof(T);
100 const size_t offBytes = static_cast<size_t>(it - itBeg) * sizeof(T);
101 detail::VectorVTable<T>::destruct(Parent::getData(), offBytes, numBytes);
102 Parent::header.sizeBytes -= static_cast<decltype(Parent::header.sizeBytes)>(numBytes);
103 return it != itEnd;
104 }
105
106 /// @brief Removes all values equal to `value`
107 /// @see Algorithms::removeIf

Callers 2

removeFunction · 0.85
removeMethod · 0.85

Calls 3

beginFunction · 0.85
endFunction · 0.85
removeIfFunction · 0.85

Tested by

no test coverage detected