From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- graphs/cpp/exist_functor/example.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 graphs/cpp/exist_functor/example.cc (limited to 'graphs/cpp/exist_functor/example.cc') diff --git a/graphs/cpp/exist_functor/example.cc b/graphs/cpp/exist_functor/example.cc new file mode 100644 index 0000000..d580f7b --- /dev/null +++ b/graphs/cpp/exist_functor/example.cc @@ -0,0 +1,24 @@ +#include + +#include "exist.hh" + +int main() +{ + Exist exist_int; + Exist exist_str; + + // Test with integers + std::cout << std::boolalpha; + std::cout << exist_int(1) << std::endl; // Prints false + std::cout << exist_int(2) << std::endl; // Prints false + std::cout << exist_int(1) << std::endl; // Prints true + std::cout << exist_int(3) << std::endl; // Prints false + + // Test with strings + std::cout << exist_str(std::string("Hello")) << std::endl; // Prints false + std::cout << exist_str(std::string("World")) << std::endl; // Prints false + std::cout << exist_str(std::string("Hello")) << std::endl; // Prints true + std::cout << exist_str(std::string("C++")) << std::endl; // Prints false + + return 0; +} -- cgit v1.2.3