diff options
Diffstat (limited to 'graphs/cpp/exist_functor/example.cc')
| -rw-r--r-- | graphs/cpp/exist_functor/example.cc | 24 |
1 files changed, 24 insertions, 0 deletions
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 <iostream> + +#include "exist.hh" + +int main() +{ + Exist<int> exist_int; + Exist<std::string> 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; +} |
