9#ifndef WARPX_UTILS_ALGORITHMS_ISIN_H_
10#define WARPX_UTILS_ALGORITHMS_ISIN_H_
28 template <
typename TV,
typename TE,
29 class =
typename std::enable_if_t<std::is_convertible_v<TE,TV>>>
30 bool is_in(
const std::vector<TV>& vect,
33 return (std::find(vect.begin(), vect.end(), elem) != vect.end());
48 template <
typename TV,
typename TE,
49 class =
typename std::enable_if_t<std::is_convertible_v<TE,TV>>>
51 const std::vector<TE>& elems)
53 return std::any_of(elems.begin(), elems.end(),
54 [&](
const auto elem){return is_in(vect, elem);});
bool is_in(const std::vector< TV > &vect, const TE &elem)
Returns true if an item of type TE is in a vector of TV objects (provided that TE can be converted in...
Definition IsIn.H:30
bool any_of_is_in(const std::vector< TV > &vect, const std::vector< TE > &elems)
Returns true if any of the items of a vector<TE> is contained in another vector<TV> (provided that TE...
Definition IsIn.H:50