Answers for "c++ check if function exists"

C++
2

how to tell c++ a function exists before calling

if (typeof yourFunctionName == 'function') { 
  yourFunctionName(); 
}
Posted by: Guest on March-28-2020
0

c++ check if function exists

When you declare 'sum' you could declare it like:

#define SUM_EXISTS
int sum(std::vector<int>& addMeUp) {
    ...
}

Then when you come to use it you could go:

#ifdef SUM_EXISTS
int result = sum(x);
...
#endif
Posted by: Guest on March-06-2022

Code answers related to "c++ check if function exists"

Browse Popular Code Answers by Language