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

Name

Description

container

The container to search.

key

The key to look for.

Created with MrDocs