online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; template <class Stub> struct member { static typename Stub::type value; }; template <class Stub> typename Stub::type member<Stub>::value; template <class Stub, typename Stub::type x> struct private_member { private_member() { member<Stub>::value = x; } static private_member instance; }; // struct PapaPavlica { private: char const* papini_dengi = "papini dengi"; }; // подменный тип, чтобы компилятор не ругался struct A_x { typedef char const *(PapaPavlica::*type); }; // магия, здесь живут драконы template struct private_member<A_x, &PapaPavlica::papini_dengi>; int main() { PapaPavlica papa; papa.*member<A_x>::value = "deneg net"; std::cout << papa.*member<A_x>::value << std::endl; // deneg net }

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