20 lines
1.1 KiB
C++
20 lines
1.1 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* easyfind.tpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/04/03 10:19:59 by rparodi #+# #+# */
|
|
/* Updated: 2025/04/03 11:18:50 by rparodi ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
template <typename T>
|
|
typename T::iterator easyfind(T &container, int value)
|
|
{
|
|
typename T::iterator it = std::find(container.begin(), container.end(), value);
|
|
if (it == container.end())
|
|
throw std::runtime_error("Value not found");
|
|
return it;
|
|
}
|