-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
A boolean cast operator for ConditionalOStream may help make it easier to easily support optionally calling functions which take a std::ostream as an argument.
void myFunction(std::ostream &os) {
os << "myFunction called!\n";
}
int main() {
ConditionalOStream cstream { std::cout };
if (cstream) {
myFunction(*cstream.mOStream);
}
return 0;
}Or, if it also has a get method for the ostream reference:
void myFunction(std::ostream &os) {
os << "myFunction called!\n";
}
int main() {
ConditionalOStream cstream { std::cout };
if (cstream) {
myFunction(cstream.get());
}
return 0;
}Metadata
Metadata
Assignees
Labels
No labels