[#CuckooCache-cache-contains] = xref:CuckooCache.adoc[CuckooCache]::xref:CuckooCache/cache.adoc[cache]::contains :relfileprefix: ../../ :mrdocs: contains iterates through the hash locations for a given element and checks to see if it is present. == Synopsis Declared in `<cuckoocache.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool contains( Element const& e, bool const erase) const; ---- == Description contains does not check garbage collected state (in other words, garbage is only collected when the space is needed), so: ` insert(x); if (contains(x, true)) return contains(x, false); else return true; ` executed on a single thread will always return true! This is a great property for re‐org performance for example. contains returns a bool set true if the element was found. == Return Value true if the element is found, false otherwise == Parameters [cols="1,4"] |=== | Name| Description | *e* | the element to check | *erase* | whether to attempt setting the garbage collect flag |=== == Postconditions * if erase is true and the element is found, then the garbage collect flag is set [.small]#Created with https://www.mrdocs.com[MrDocs]#