Answer the question
In order to leave comments, you need to log in
How to understand a function call inside another function with a different number of parameters?
While analyzing the unit test example, I came across the following piece of code:
void Assert(bool b, const string& hint) {
AssertEqual(b, true, hint);
}
void AssertEqual (class T& t, const U& u, const string& hint) { if (t != u) {
ostringstream os;
os << "Assertion failed: " << t << "!=" << u << "Hint: " << hint; throw runtime_error(os);
} }
Answer the question
In order to leave comments, you need to log in
In short, the first Assert function needs to be renamed to AssertIsTrue , and the hint parameter to errorMsg . There should be text that will explain in runtime_error where the b parameter value from the Assert function came from . For example, a function name with arguments or a variable name.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question