@@ -46,6 +46,7 @@ INCLUDES
4646
4747#include " simgear/misc/sg_path.hxx"
4848#include " FGJSBBase.h"
49+ #include " math/FGColumnVector3.h"
4950
5051/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5152FORWARD DECLARATIONS
@@ -55,9 +56,13 @@ namespace JSBSim {
5556
5657class Element ;
5758
58- // The return type of std::setprecision is unspecified by the C++ standard so we
59- // need some C++ magic to be able to overload the operator<< for std::setprecision
59+ // The return type of these functions is unspecified by the C++ standard so we
60+ // need some C++ magic to be able to overload the operator<< for these functions.
6061using setprecision_t = decltype (std::setprecision(0 ));
62+ // For MSVC set_precision_t and setw_t are the same type
63+ #ifndef _MSC_VER
64+ using setw_t = decltype (std::setw(0 ));
65+ #endif
6166
6267enum class LogLevel {
6368 BULK, // For frequent messages
@@ -114,10 +119,18 @@ class JSBSIM_API FGLogging
114119 virtual ~FGLogging () { Flush (); }
115120 FGLogging& operator <<(const char * message) { buffer << message ; return *this ; }
116121 FGLogging& operator <<(const std::string& message) { buffer << message ; return *this ; }
117- FGLogging& operator <<(unsigned int value) { buffer << value; return *this ; }
122+ template <typename T, typename = std::enable_if_t <std::is_arithmetic<T>::value>>
123+ FGLogging& operator <<(T value) { buffer << value; return *this ; }
118124 FGLogging& operator <<(std::ostream& (*manipulator)(std::ostream&)) { buffer << manipulator; return *this ; }
125+ FGLogging& operator <<(std::ios_base& (*manipulator)(std::ios_base&)) { buffer << manipulator; return *this ; }
119126 FGLogging& operator <<(setprecision_t value) { buffer << value; return *this ; }
127+ // Avoid duplicate definition for MSVC for which set_precision_t and setw_t
128+ // are the same type
129+ #ifndef _MSC_VER
130+ FGLogging& operator <<(setw_t value) { buffer << value; return *this ; }
131+ #endif
120132 FGLogging& operator <<(const SGPath& path) { buffer << path; return *this ; }
133+ FGLogging& operator <<(const FGColumnVector3& vec) { buffer << vec; return *this ; }
121134 FGLogging& operator <<(LogFormat format);
122135 std::string str (void ) const { return buffer.str (); }
123136 void Flush (void );
0 commit comments