C++ property support

Stefan Strasser sstrasser@systemhaus-gruppe.de
Sat Apr 9 19:44:00 GMT 2005

Christian Parpart schrieb:

> and the microsoft proposal (derived from C#)
> class my_bar {
> public: 
>     property int bar {
>         int get() { return value; }
>         void set(int v) { value = v; }
>     }
> private:
>     int value;
> }
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1600.html

first of all, I think comp.lang.c++.moderated is a better place to 
discuss things like that.

then, I don't think the next version of C++ will have properties as a 
language feature.
see n1615 for a few arguments by comitee members.
I don't agree with all of them but the most important is: without 
reflection, properties are only a syntax change of something you can 
achieve without properties as well.

this paper also proposes a library solution without core language 
extension you might be interested in - although it has drawbacks like 
implementation pointer overhead.


Stefan Strasser

More information about the Gcc-help mailing list