[#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&period;

== Synopsis

Declared in `&lt;cuckoocache&period;h&gt;`

[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&colon;

&grave; insert(x)&semi; if (contains(x, true)) return contains(x, false)&semi; else return true&semi; &grave;

executed on a single thread will always return true!

This is a great property for re&hyphen;org performance for example&period;

contains returns a bool set true if the element was found&period;

== 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]#
