1

templates for << chaining + new manipulators

This commit is contained in:
churl
2022-05-06 16:51:41 +02:00
parent ab7a9c2ecb
commit 12513926d8
6 changed files with 187 additions and 184 deletions

View File

@ -53,9 +53,19 @@ public:
void flush() override;
// NOTE: I added this
// TODO: Problem: Implementing this here breaks the << chaining
// CGA_Stream& operator<<(const fgc&);
// CGA_Stream& operator<<(const bgc&);
template<typename T>
friend T& operator<<(T& os, const fgc& fg) {
os.flush();
os.color_fg = fg.fg;
return os;
}
template<typename T>
friend T& operator<<(T& os, const bgc& bg) {
os.flush();
os.color_fg = bg.bg;
return os;
}
};
#endif