Don't make a copy of the collection when using alg::contains

This commit is contained in:
Ian McInerney 2020-10-27 00:41:18 +00:00
parent 0948d67e56
commit e739d5ba65
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,7 @@ void for_all_pairs( _InputIterator __first, _InputIterator __last, _Function __f
* @brief Returns true if the container contains the given value. * @brief Returns true if the container contains the given value.
*/ */
template <class _Container, typename _Value> template <class _Container, typename _Value>
bool contains( _Container __container, _Value __value ) bool contains( const _Container& __container, _Value __value )
{ {
return std::find( __container.begin(), __container.end(), __value ) != __container.end(); return std::find( __container.begin(), __container.end(), __value ) != __container.end();
} }