Boost logo

Boost :

Subject: Re: [boost] [property] interest in C# like properties for C++?
From: Sergey Sadovnikov (flex_ferrum_at_[hidden])
Date: 2009-10-21 14:41:46


Hello, Matthew.

Wednesday, October 21, 2009 at 12:07:28 AM you wrote:

MC> 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
MC> Very nice. Do you know how reliable your reliance on UB is on the major
MC> platforms? If it works on MSVC 9+, GCC 4.1, and darwin, that's enough
MC> for me.

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

FYI:
http://lists.boost.org/Archives/boost/2008/07/139609.php

I use this library during last year in two quite big projects. Now
this library supports:

 - Triviral properties (also support property initialization inside
 declaration)
 - Properties with setters/getters
 - Indexable properties (up to three dimensions)
 - Abstract properties
 - Runtime properties enumeration
 - Generic setters/getters by property name (in runtime)
 - Generic setters/getters with conversion from/to string (but not for
 all cases)
 - Generic serialization with boost::serialization-like interface.

 Properties supports full set of unary/binary operators, 'member
 access' operator, and some other useful things.

-- 
Best Regards,
 Sergey                          mailto:flex_ferrum_at_[hidden]

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