Boost logo

Boost :

From: Gustavo Guerra (gustavobt_at_[hidden])
Date: 2002-02-13 09:00:36


It really works like you said? Great. I tried to do something like that long time ago, but I never made it to work with a nice
interface like that.

I'm interested :)

Gustavo Guerra

----- Original Message -----
From: "Geurt Vos" <G.Vos_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 13, 2002 9:01 AM
Subject: [boost] properties in C++

> Hi,
> I was wondering if there's interest in "properties
> for C++". Properties in the sense of: assigning
> to a data member will call a user-defined 'set'
> function, reading from the data member will call
> a user-defined 'get' function.
>
> Example:
>
> class A {
> private:
> void set_it(int);
> int get_it() const;
> public:
> [...] value;
> };
>
> A a;
> a.value = 100;
> -> a.set_it(100);
> int i = a.value
> -> int i = a.get_it();
> int i = a.value = 100;
> -> a.set_it(100);
> -> int i = a.get_it();
>
> For the declaration I'm thinking of something like:
>
> boost::property<
> boost::read<int,A,&A::get_it>,
> boost::write<int,A,&A::set_it>
> > value;
>
> * it doesn't matter whether read<> or write<> comes first
> * if write<> is missing, the property is read-only
> * if read<> is missing, the property is write-only
>
> Is there any interest in this? I do have an implementation
> lying around. I can have it uploaded within a few days
> (have to boostify the thing...).
>
> Geurt
>
>
> Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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