Boost logo

Boost :

From: Jan Langer (jan_at_[hidden])
Date: 2002-02-26 03:26:12


On Tue, 26 Feb 2002, dylan_nicholson wrote:
>--- In boost_at_y..., Jan Langer <jan_at_l...> wrote:
>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.

why not drop the defer() and say that calls to set can always be
buffered. you can also commit (or flush) them be hand or at least on
destruction of the attribute_set.
i'll try to write an implementation of an (at least two) example
attributes.

>(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).

it does not require any friend declarations. and i don't see why
  a.get <size> ()
looks (or is) better than
  get <size> (a)

another thing is that also calls of
  get <size> ("file.txt")
must be possible without an attribute_set.

-- 
jan langer ... jan_at_[hidden]
"pi ist genau drei"

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