#include template class Property { public: using GetterFn = T&(); using SetterFn = void(const T&); template constexpr Property(Getter&& getter, Setter&& setter) noexcept : m_getter(getter), m_setter(setter) { } Property& operator=(const T& value) { m_setter(value); return *this; } operator T& () { return m_getter(); } operator const T& () const { return m_getter(); } private: std::function m_getter; std::function m_setter; }; /* Usage _____ In-class declaration: T = any type Property myProp { [&]() -> T& { ... }, // Getter [&](const T& value) { ... } // Setter }; Property access example: other = myProp; // assign other variable from property myProp = other; // assign property from other variable */