This commit is contained in:
aortigos
2026-04-17 21:00:49 +02:00
commit ab04a0f8fa
3 changed files with 99 additions and 0 deletions

29
ex00/easyfind.hpp Normal file
View File

@@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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();
}