online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include<string> struct Name { bool valid() { return true; } int value () { return 5; } }; struct Server1 { Name getX() { std::cout<<"getX called"<<std::endl; return Name(); } }; struct Server2 { Name getY() { std::cout<<"getY called"<<std::endl; return Name(); } }; template<typename ParamX, typename RType> //--vvvv---------------------->auto type deduction auto funcX(ParamX param,RType (ParamX::*callable)()){ std::cout<<"funcX called"<<std::endl; auto result = ((param.*callable)()); // check result is valid if(!result.valid()){ // print a log message for ParamX // add appropriate return statement if needed } return result.value(); } int main() { funcX(Server1(), &Server1::getX); funcX(Server2(), &Server2::getY); 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