I deeply disagree!
Our code is riddled with heavily overloaded meanings in a single value/domain, and if you have a variety of filters, you end up with this atrocity:
Foo *f1; // hey, just test for NULL
double f2; // hey, just use isnan()
int f3; // aaaaah, crap
bool f3_specified; // god why
std::string f4;
// requires heavy drugs to solve existential catastrophes
Compare that to
template
struct Filter {
bool is_specified;
T value;
};
Filter f1;
Filter f2;
Filter f3;
Filter f4;
And the variety of code that has to work with either of these examples.
What happens if the boolean is true but the filter is null?
An assertion fails miserably.
What would the vice versa case even mean?
That an assertion failed miserably.
What happens if the filter is one? Minus one? Equals to PC(IP), BP? If NULL filter has to search for NULL values in a dataset? If we are looking for NAN values in a corrupted one (this one is even more tricky)?
Deeply!