summaryrefslogtreecommitdiff
path: root/graphs/cpp/exist_functor/example.cc
blob: d580f7b0c7df514acf4ce03657422690f90a575f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}