Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class T>
- struct IsSetProperty
- {
- IsSetProperty(): property(0), isSetProperty(false)
- {
- }
- T property;
- bool isSetProperty;
- };
- class Foo
- {
- public:
- Foo(): property1(0), isSetProperty1(false)
- {
- }
- //getter + setters depending on the case #1 or #2
- private:
- // first case using another bool to ensure that property is set.
- int property1;
- bool isSetProperty1;
- // second case using struct IsSetProperty
- IsSetProperty<int> property2;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement