
Hi Emil, Emil Dotchevski wrote:
On Mon, May 10, 2010 at 9:10 PM, Barend Gehrels <barend@geodan.nl> wrote:
We did exactly the same for Boost.Geometry (long ago). First have non-const-ref getters and lateron moved to setters... Seems it cannot be avoided.
I'm interested to know why did you move to setters.
For the same reason as you did. Some classes do not support a public non-const reference and have a function like "set". I dived into old correspondations about this. Quoted (from Bruno):
- the problem is at least technically solvable by returning an assigner, that is an object with a reference to the point and that has the actual setting operation in its operator=.
But then:
The problem is that you can state: double& d = geometry::get(p); ...... lateron: d = 5;
So we decided to move to get/set to avoid this (maybe uncommon) scenario. Boost.Polygon does the same thing. Regards, Barend