Boost logo

Boost :

From: dylan_nicholson (dylan_nicholson_at_[hidden])
Date: 2002-02-25 19:46:51


--- In boost_at_y..., Jan Langer <jan_at_l...> wrote:
> i uploaded a new version of filesystem which meets bemans
requirements.
>
> i have created a class attribute_set (according to dylans
proposal). i
> implemented only three attributes to provide an example.

We need something better than require() for setting multiple
properties: Let's say I wanted to set the owner and group at the
same time, and doing both together at the OS level would take half as
long as doing one then the other.
The best I can think of is:

   attribute_set a(my_file_name);
   a.defer();
   a.set<owner>("dylan");
   a.set<group>("users");
   a.commit();

defer() and commit() again are completely optional. If you only need
one attribute, or don't care about the potential performance hit,
then leave them out. I would probably go further and say an
implementation is allowed to ignore them too, so that failing to call
commit() after defer() has an implementation-defined outcome.

(btw I really don't like the free function notation - it just looks
atypical. I understand it's purely a syntactical thing, but I think
you'll find it matters more in many developers minds. Also in this
case for implementations that do honour require/defer/commit it
probably requires a template friend declaration, which is not a good
idea).

Dylan


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