folly::contains

This function checks whether container contains given key. Use container specific .contains() implementation if available, otherwise uses .find() implementation.

Synopsis

Declared in <folly/container/CollectionUtil.h>

template<
    class C,
    class K = C::key_type>
requires (detail::HasContains<C, K> || detail::HasFind<C, K>)
bool
contains(
    C const& container,
    K const& key);

Return Value

true if the container contains the key, false otherwise.

Parameters

NameDescription
containerThe container to search.
keyThe key to look for.