Possible Duplicate:
How to detect whether there is a specific member variable in class?
I'm adding features to a C++ library. A thing that'd come in handy was to check if a certain member exists in a struct (it exisits depending on the library version - unfortunately there is no "version" parameter in the library).
Here is a simplified example of what I'd like to do:
struct options {
int option1;
std::string option2;
float option3; // might be included or not
options();
void random_method();
}
options::options() {
option1 = 1;
option2 = "foo";
if( EXISTS(option3) ) { // Pseudo-Code -> can I do that at all?
option3 = 1.1;
}
}