I want to check if the data field is valid (valid means that it is not null and not populated with the default value)
Primarily
return (!connector->IsNull(field_id) and connector->Get<type>Default(field_id, default_value))
But the "type" can be one of many types (string, int64, etc.), so there are 5-6 different functions. I made a helper function for it, and I'm trying to pass the corresponding GetDefault ...
template<typename T> bool IsValidField(std::unique_ptr<Connector>& connector, const std::function<T(int, T)> &GetDefault, int field_id, T default_value){
return (!connector->IsNull(field_id) && connection->GetDefault(field_id, default_value) != default_value);
}
And I call the helper function with ....
IsValidField(connector, connector->GetStringWithDefault,20,"")
I get the error "error: the reference to the non-stationary member function must be called" because GetStringWithDefault is not a static function, how can I fix this?
Alternatively, is there a way to make it a little less uncomfortable?