Lines Matching defs:action
131 // The action`s return true means meeting the erase condition
132 // The action`s return false means not meeting the erase condition
133 size_type EraseIf(const std::function<bool(const key_type &key, mapped_type &value)> &action) noexcept
135 if (action == nullptr) {
141 entries_, [&action](value_type &value) -> bool { return action(value.first, value.second); });
145 if (action((*it).first, (*it).second)) {
156 void ForEach(const std::function<bool(const key_type &, mapped_type &)> &action)
158 if (action == nullptr) {
163 if (action(key, value)) {
169 void ForEachCopies(const std::function<bool(const key_type &, mapped_type &)> &action)
171 if (action == nullptr) {
176 if (action(key, value)) {
182 // The action's return value means that the element is keep in map or not; true means keeping, false means removing.
183 bool Compute(const key_type &key, const std::function<bool(const key_type &, mapped_type &)> &action)
185 if (action == nullptr) {
197 if (!action(it->first, it->second)) {
203 // The action's return value means that the element is keep in map or not; true means keeping, false means removing.
204 bool ComputeIfPresent(const key_type &key, const std::function<bool(const key_type &, mapped_type &)> &action)
206 if (action == nullptr) {
214 if (!action(key, it->second)) {
220 bool ComputeIfAbsent(const key_type &key, const std::function<mapped_type(const key_type &)> &action)
222 if (action == nullptr) {
230 entries_.emplace(key, action(key));