Boost logo

Boost :

From: William E. Kempf (williamkempf_at_[hidden])
Date: 2002-08-01 08:59:49


----- Original Message -----
From: "Mattias Flodin" <flodin_at_[hidden]>
To: "Boost" <boost_at_[hidden]>
Sent: Thursday, August 01, 2002 3:08 AM
Subject: [boost] filesystem library const usage

> Secondly, if it is really a good idea to return const objects for all
> functions and not just operators, should that be a coding policy for
> boost? Should we look over the other libraries and make sure they all
> return const objects?

Nope. This prevents call chaining, which can be an important design usage.
For instance, the attribute types I'm working on for Boost.Threads allow
call chaining in order to do in place construction:

boost::thread thread(&func,
    boost::thread_attributes().
        set_priority(BOOST_ABOVE_NORMAL).
        set_stacksize(1024));

There's other legitimate reasons for doing this as well.

Bill Kempf


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