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

40
ex00/main.cpp Normal file
View File

@ -0,0 +1,40 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 19:33:56 by adjoly #+# #+# */
/* Updated: 2025/04/14 19:39:02 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "easyfind.hpp"
#include <stdexcept>
#include <vector>
#include <iostream>
std::vector<int> *newVec() {
std::vector<int> *vec = new std::vector<int>;
for (size_t i = 0; i < 10; i++) {
vec->push_back(i);
}
return vec;
}
int main(void) {
std::vector<int> *vec = newVec();
try {
std::vector<int>::iterator it = easyfind<std::vector<int> >(*vec, 8);
std::cout << "found value : " << *it << std::endl;
} catch (std::runtime_error &e) {
std::cerr << e.what() << std::endl;
}
try {
std::vector<int>::iterator it = easyfind<std::vector<int> >(*vec, 13);
std::cout << "found value : " << *it << std::endl;
} catch (std::runtime_error &e) {
std::cerr << e.what() << std::endl;
}
}