From e8804cff5b952078af00e21661c27c1559d3cd6f Mon Sep 17 00:00:00 2001 From: Myles Busig Date: Sun, 28 Jul 2024 18:08:21 -0600 Subject: [PATCH] Add log::stream_type typedef This addition is useful when an explicit template instantiation of operator<< is needed, for example, when logging from an ARM mode function. Example usage: template mtl::log::stream_type& mtl::log::stream_type::operator<< (uint16_t); ARM_MODE void foo(int16_t x) { mtl::log::debug << x; // Without the explicit template instantiation, an ODR violation would occur. } --- include/mtl/log.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/mtl/log.hpp b/include/mtl/log.hpp index 8e776be..d8aa0e6 100644 --- a/include/mtl/log.hpp +++ b/include/mtl/log.hpp @@ -21,6 +21,8 @@ constexpr char endl_char = 0; constexpr char endl_char = '\n'; #endif +using stream_type = basic_string_stream; + /** * \brief Log stream * @@ -42,7 +44,7 @@ constexpr char endl_char = '\n'; * On MGBA this also starts the line with "GBA Debug: ",so the line is not * completely blank either. */ -class stream : public basic_string_stream { +class stream : public stream_type { private: level m_log_level;