Skip to content

Instantly share code, notes, and snippets.

@cirosantilli
Created October 9, 2019 18:08
Show Gist options
  • Save cirosantilli/d438e38f05a92422f909c0571a2dac16 to your computer and use it in GitHub Desktop.
Save cirosantilli/d438e38f05a92422f909c0571a2dac16 to your computer and use it in GitHub Desktop.
gdb cout
#include <iostream>
struct MyClass {
int i;
MyClass() { i = 0; }
};
std::ostream& operator<<(std::ostream &oss, const MyClass &my_class) {
return oss << "MyClass: i = " << my_class.i;
}
int main() {
MyClass i;
std::cout << i << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment