WarpX
Loading...
Searching...
No Matches
utils::algorithms Namespace Reference

Functions

template<typename TV, typename TE, class = typename std::enable_if_t<std::is_convertible_v<TE,TV>>>
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 into TV), false otherwise.
 
template<typename TV, typename TE, class = typename std::enable_if_t<std::is_convertible_v<TE,TV>>>
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 can be converted into TV)
 

Function Documentation

◆ any_of_is_in()

template<typename TV, typename TE, class = typename std::enable_if_t<std::is_convertible_v<TE,TV>>>
bool utils::algorithms::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 can be converted into TV)

Template Parameters
TVthe typename of the first vector elements
TVthe typename of the second vector elements
Parameters
vecta vector of TV objects
elemsa vector of TE objects
Returns
true if any element of elems is in vect, false otherwise

◆ is_in()

template<typename TV, typename TE, class = typename std::enable_if_t<std::is_convertible_v<TE,TV>>>
bool utils::algorithms::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 into TV), false otherwise.

Template Parameters
TVthe typename of the vector elements
TEthe typename of the item
Parameters
vecta vector of TV objects
eleman object of type TE
Returns
true if elem is in vect, false otherwise