Boost logo

Boost :

From: J.F.K. (beholder_at_[hidden])
Date: 2003-10-29 01:23:27


Yes, it is very interesting!
I've had a look to your documentation and I think your example
could be rewritten as that

class Foo {
public: // ...'tors
    Foo (int bar=0)
       : m_bar(bar), bar(this)
    {}

public: // properties
    struct bar_tag {};
setgetter<property<Foo, int>, bar_tag> bar;

private: // implementation details
    void set (const int bar, bar_tag=bar_tag())
    { m_bar = bar; }

    const int get (bar_tag=bar_tag()) const
    { return m_bar; }

    int m_bar;
};

Foo object;

object.bar = 22;
std::cout << object.bar << '\n';

the idea is that now setgetter knows what a function it must
call to access m_bar without passing pointers of these
functions to getsetter constructor

I really hate ponters here, because of pessimisation, most of
compilers can't inline function if pointer on it is used

regards,
Oleg

"Matthias Becker" <bekkah_at_[hidden]> wrote in message
news:200310281610.h9SGAhQ00729_at_mailgate5.cinetic.de...
> Hi
>
> I develope a small libray for my needs. But there is one part that could be used everywhere. It is somewhat similar to C#'s getter and setter. I thougt it might be interesing for boost.
>
> http://helium.piranho.de/dateien/msb.zip
>
> this file includes a small documentation and all files that you need.
>
> CU


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