MCPcopy Create free account
hub / github.com/avast/retdec / removeFromSet

Function removeFromSet

include/retdec/utils/container.h:296–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294*/
295template<typename T>
296void removeFromSet(std::set<T> &from, const std::set<T> &toRemove) {
297 // The solution using std::set_difference<> is slightly faster
298 // than this manual loop:
299 //
300 // for (auto &item : toRemove) {
301 // from.erase(item);
302 // }
303 //
304 // Timings (containers with 10000000 elements):
305 //
306 // T | std::set_difference | for loop |
307 // ------------|---------------------|----------|
308 // int | 3.08s | 4.43s |
309 // std::string | 3.74s | 6.87s |
310 //
311 from = setDifference(from, toRemove);
312}
313
314/**
315* @brief Returns @c true if @a s1 is disjoint with @a s2.

Callers 1

TEST_FFunction · 0.85

Calls 1

setDifferenceFunction · 0.85

Tested by 1

TEST_FFunction · 0.68