This avoids unresolved external errors on MSVC. It's not ideal because
every translation unit will have its own copy of the references and
initialize them separately, but the overhead for calling the instance
accessor function is not too large.
throw invalid_argument("Console::instance");
}
-Console &cin = Console::instance(Console::CIN);
-Console &cout = Console::instance(Console::COUT);
-Console &cerr = Console::instance(Console::CERR);
-
} // namespace IO
} // namespace Msp
static Console &instance(Stream);
};
-MSPCORE_API extern Console &cin;
-MSPCORE_API extern Console &cout;
-MSPCORE_API extern Console &cerr;
+// TODO make these inline instead of static when upgrading to C++17.
+static Console &cin = Console::instance(Console::CIN);
+static Console &cout = Console::instance(Console::COUT);
+static Console &cerr = Console::instance(Console::CERR);
} // namespace IO
} // namespace Msp