#include #include #include "pEp/inspect.hh" #include "../examples/libc99/libc99.h" #include "../src/libc99.hh" //#include "../src/POTS.hh" using namespace pEp; struct Struct { int a; int b; }; template class Field { public: Field() = default; Field(T* target) { bind(target); } void bind(T* target) { _target = target; } operator T() { return *_target; } Field& operator=(T val) { *_target = val; return *this; } private: T* _target{ nullptr}; }; class A : public Field { public: A() : _obj{ std::make_shared() } { a.bind(&_obj->a); b.bind(&_obj->b); } std::shared_ptr _obj; Field a{}; Field b{}; }; int main() { Adapter::pEpLog::set_enabled(true); pEpLog("start"); A b{}; pEpLog(b.a); // pEpLog(b.b); { A a{}; a.a = 23; a.b = 42; pEpLog(a.a); // pEpLog(a.b); b = a; } pEpLog(b.a); // pEpLog(b.b); }