Boost logo

Boost :

From: Geurt Vos (G.Vos_at_[hidden])
Date: 2002-02-14 03:37:48

> IMHO, the ONLY advantage of a 'property' in comparison with
> the good old:
> int const& foo() const { return m_foo ; }
> int & foo() { return m_foo ; }
> int m_foo ;
> is that the user don't have to write the extra '()'.

This isn't exactly the same. That is, foo() returns
a reference to the internal object, which means one
can assign directly to it. This is exactly what I
don't want. foo() = 0 shouldn't get past the compiler.
Instead it should be something like:

    int foo() const;
    void foo(int);

then stuff like:

    int i =;;

is still nice, but it can get ugly: * 20); +;

whereas with properties you'd write: *= 20; +=;


Boost list run by bdawes at, gregod at, cpdaniel at, john at