minimal fixes

This commit is contained in:
Angel Ortigosa Perez
2026-04-21 21:55:24 +02:00
parent ca8a9c7010
commit 39b7ee24e2
2 changed files with 13 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
/* 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 */
/* Updated: 2026/04/21 21:49:31 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,7 +14,7 @@
#include <vector>
template <typename T>
typename T::iterator easyfind(T array, int nb)
typename T::iterator easyfind(T &array, int nb)
{
for(typename T::iterator it = array.begin();
it != array.end();

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/17 20:26:58 by aortigos #+# #+# */
/* Updated: 2026/04/17 20:59:40 by aortigos ### ########.fr */
/* Updated: 2026/04/21 21:54:47 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
@@ -21,7 +21,16 @@ int main()
arr.push_back(3);
arr.push_back(2);
std::cout << *easyfind(arr, 4) << std::endl;
try {
std::cout << *easyfind(arr, 4) << std::endl;
} catch (std::exception &e) {
std::cout << "Not found" << std::endl;
}
try {
std::cout << *easyfind(arr, 99) << std::endl;
} catch (std::exception &e) {
std::cout << "Not found" << std::endl;
}
return (0);
}