1
0

」 feat: finished ex00

This commit is contained in:
2025-04-14 19:39:20 +02:00
commit 35fc155f65
8 changed files with 246 additions and 0 deletions

24
ex00/easyfind.hpp Normal file
View File

@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* easyfind.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 19:07:43 by adjoly #+# #+# */
/* Updated: 2025/04/14 19:33:52 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <algorithm>
#include <iterator>
#include <stdexcept>
template <typename T> typename T::iterator easyfind(T val, int what) {
typename T::iterator it = std::find(val.begin(), val.end(), what);
if (it == val.end())
throw std::runtime_error("value not found");
return it;
}