Implement formatting of objects with (s)printf.

This commit is contained in:
vitaut
2015-09-08 08:36:20 -07:00
parent 59155abbf3
commit 79d8f59906
4 changed files with 23 additions and 13 deletions

View File

@@ -67,3 +67,16 @@ inline FILE *safe_fopen(const char *filename, const char *mode) {
return std::fopen(filename, mode);
#endif
}
class TestString {
private:
std::string value_;
public:
explicit TestString(const char *value = "") : value_(value) {}
friend std::ostream &operator<<(std::ostream &os, const TestString &s) {
os << s.value_;
return os;
}
};