Boost logo

Boost :

Subject: Re: [boost] [property] interest in C# like properties for C++?
From: Matthew Chambers (matthew.chambers_at_[hidden])
Date: 2009-10-20 16:07:28


Peder Holt wrote:
> It now compiles without warnings, also for classes with virtual members.
> Operator support is added for operator*.
> http://codepad.org/A4vaAMPZ
>
> Regards
> Peder
Very nice. Do you know how reliable your reliance on UB is on the major
platforms? If it works on MSVC 9+, GCC 4.1, and darwin, that's enough
for me.

Do you plan to have a macro for defining simple/trivial properties with
a single line? A more sophisticated macro could define the functions to
use for the getter/setter (similar to how Managed C++ and C++/CLI do it
AFAIK). Just like in C#, it encourages good design from the start of an
implementation: the first iteration can use properties backed by simple
member variables, while future implementations may use a more
complicated backend without the interface ever needing to change (and
without resorting to set/get syntax). That allows the design focus at
first to be on the interface instead of worrying about doing a good job
on both the interface and the implementation.

-Matt


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk