1
0
Files
CPP_Module_08/ex00/main.cpp
2025-04-14 19:39:20 +02:00

41 lines
1.6 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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;
}
}