$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Roberto Hinz (robhz786_at_[hidden])
Date: 2019-06-09 16:37:17
On Sun, Jun 9, 2019 at 2:40 AM Helmut Zeisel <HZ2012_at_[hidden]> wrote:
> Von: "Roberto Hinz via Boost" <boost_at_[hidden]>
>
> >> With a function object based interface, one could easily store and reuse
> >> different formating options in parallel.
> >>
>
> > Not clear to me what you mean by that. Could you explain better ?
>
> This is a general difference between functions and funcion objects.
>
> If you use functions, you either need a global state
> (which is not thread-safe and has to be reset after every change because
> you might rely on the original state at some other place in the program),
> or you have to specify all options at every call (which might be quite a
> lot in the case of formatting).
>
> Function objects can store the state/options internally.
> When you use two (or more) different options alternating, you create two
> (or more) function objects and use these objects alternating without
> changing the global state and without specifying the different options
> again.
>
> Helmut
>
I see. Although Boost.Stringify does use function objects,
they don't store formatting, but only things like numeric punctuation.
So you need to specify all formatting at every call.