Files
cpp08/ex00/easyfind.hpp
aortigos ab04a0f8fa ex00
2026-04-17 21:00:49 +02:00

29 lines
1.2 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* easyfind.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/17 20:26:54 by aortigos #+# #+# */
/* Updated: 2026/04/17 21:00:25 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include <iostream>
#include <vector>
template <typename T>
typename T::iterator easyfind(T array, int nb)
{
for(typename T::iterator it = array.begin();
it != array.end();
it++)
{
if (*it == nb)
{
return (it);
}
}
throw std::exception();
}