+
+#ifdef _WIN32
+ inline WindowsStream& GetStreamHandle(std::ostream& os)
+ {
+ if (os.rdbuf() == std::cerr.rdbuf())
+ return StandardError;
+
+ if (os.rdbuf() == std::cout.rdbuf())
+ return StandardOutput;
+
+ // This will never happen.
+ throw std::invalid_argument("Tried to write color codes to a stream other than stdout or stderr!");
+ }
+#endif