online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <source_location> template<class BaseClass> struct LoggingClass { protected: template <typename... Ts> struct FAEWE_LOG_THREAD { FAEWE_LOG_THREAD( const char * formatString, Ts &&... logArguments, const std::source_location & sourceLocation = std::source_location::current() ) { ////////////////////////////////////////////////////////////// // How to access <getInstrumentsId()> defined in LoggingClass? //std::cout << "InstrumentsId from LoggingClass:" << ??? ////////////////////////////////////////////////////////////// } FAEWE_LOG_THREAD( const bool fallbackToServer, const char * formatString, Ts &&... logArguments, const std::source_location & sourceLocation = std::source_location::current() ) { } }; template <typename... Ts> FAEWE_LOG_THREAD( const char *, Ts &&... ) -> FAEWE_LOG_THREAD<Ts...>; template <typename... Ts> FAEWE_LOG_THREAD( const bool, const char *, Ts &&... ) -> FAEWE_LOG_THREAD<Ts...>; inline auto getInstrumentsId() -> uint { return static_cast<BaseClass *>(this)->m_instrumentsId; // 73 } }; class Faewe : protected LoggingClass<Faewe> { friend class LoggingClass; protected: uint m_instrumentsId {73}; public: auto demo() -> void; }; auto Faewe::demo() -> void { FAEWE_LOG_THREAD( "Pi=%.3f", 3.141 ); FAEWE_LOG_THREAD( true, "Euler's=%.3f", 2.718 ); std::cout << "InstrumentsId in LoggingClass=" << this->getInstrumentsId() << std::endl; } auto main() -> int { Faewe faewe; faewe.demo(); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue