#include <Property.h>
Public Types | |
using | base_value_type = T |
base_value_type is T the type declared, and decayed_value_type is similar, but with the references etc removed (so can be set/stored) | |
Public Member Functions | |
Property ()=delete | |
![]() | |
ReadOnlyProperty ()=delete | |
nonvirtual T | Get () const |
nonvirtual | operator const T () const |
nonvirtual const T | operator() () const |
![]() | |
WriteOnlyProperty ()=delete | |
nonvirtual WriteOnlyProperty & | operator= (ArgByValueType< remove_cvref_t< T > > value) |
nonvirtual void | Set (ArgByValueType< remove_cvref_t< T > > value) |
nonvirtual void | operator() (ArgByValueType< remove_cvref_t< T > > value) |
Implement C#-like syntax for properties (syntactically like data members but backed by a getter and a setter function).
Properties are NOT movable, nor copy constructible: the data doesn't logically exist in the property itself, but in its relationship to some parent object; if it were copied, it might be copied TO some place that didn't have an appropriate enclosing object.
But, properties are ASSIGNABLE TO, because here we retain our getter/setter, and just treat assignment as copying the value.
Another important scenario, is where you have a complex, and want to update it. Properties only allow for getters and setters, not updaters. The simple solution to this is to have the Property return a REFERENCE to the object in question.
Definition at line 406 of file Property.h.
|
delete |
Properties are NOT movable, nor copy constructible: the data doesn't logically exist in the property itself, but in its relationship to some parent object; if it were copied, it might be copied TO some place that didn't have an appropriate enclosing object.