Boost logo

Boost :

Subject: Re: [boost] Interest in a '' library?
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2013-07-07 14:29:31

07.07.2013 21:40, Andrey Semashev:

> I must say I'm not sure I see the point of x. You already had to define
> set_x/get_x, so you already concealed the nature of the property x (which is
> why properties exist, right?).

I think properties exists for following reasons:
1) setter/getter have access to enveloping object internals
2) usual access syntax to field (i.e. "=") at user side
3) setter and getter are "tied" by syntax
4) virtual getter/setter, i.e. behaviour should be overridable by
derived classes.
(though, I may be wrong - I never use them)

> One additional downside I see is that you have to store this inside the
> property, which adds to the vec2 object size

Maybe property-wrapper can be constructed on-demand, not affecting
object size, like:

widget.prop() = x;
cout << widget.prop();

It only affects 2) from list above. Though it can be critical, and maybe
in that case rollback to member functions is preferred:

cout << widget.prop();

Evgeny Panasyuk

Boost list run by bdawes at, gregod at, cpdaniel at, john at