ex00
This commit is contained in:
29
ex00/easyfind.hpp
Normal file
29
ex00/easyfind.hpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user