feat: finishing the first exercice of the module 08
This commit is contained in:
parent
5b2003363f
commit
b408444a43
4 changed files with 245 additions and 0 deletions
20
cpp08/ex00/easyfind.tpp
Normal file
20
cpp08/ex00/easyfind.tpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* easyfind.tpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/03 10:19:59 by rparodi #+# #+# */
|
||||
/* Updated: 2025/04/03 11:18:50 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
template <typename T>
|
||||
typename T::iterator easyfind(T &container, int value)
|
||||
{
|
||||
typename T::iterator it = std::find(container.begin(), container.end(), value);
|
||||
if (it == container.end())
|
||||
throw std::runtime_error("Value not found");
|
||||
return it;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue