Boost logo

Boost :

Subject: Re: [boost] Interest in a '' library?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-07-07 13:40:43

On Sunday 07 July 2013 17:04:14 Metodi Todorov wrote:
> Is there any interest of "C# property" like library?
> struct vec2 {
> float get_x() const{...}
> float set_x() const{...}
> ...
> property_rw<float, vec2, &vec2::get_x, &vec2::set_x> x;
> vec2() : y(this) {}
> };
> vec2 v;
> v.x = 15.0f;
> cout << v.x << endl;
> Example:

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?).

One additional downside I see is that you have to store this inside the
property, which adds to the vec2 object size and also affects its
copyability/movability (i.e. you can't just have a default implementation of
these functions). And you're bound to the particular signatures of the set/get

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