Boost logo

Ublas :

From: Robbie Vogt (r.vogt_at_[hidden])
Date: 2006-01-11 18:02:28

Hi Daryle,

Daryle Walker wrote:
> I don't know about uBLAS, but for general I/O reasons:
> 1. It's atomic, not in the multi-threaded/processor sense, but it
> minimizes the chances that a partial printout is sent to the
> stream. (If an exception occurs in the middle of the element
> loop, nothing gets printed at all.)
Interesting point. I know this is supposed to be the case for the
extraction (>>) operator (which is generally unachievable anyway) but I
wasn't aware of this being desirable for output. I personally can't
think of any situations where this would be a concern. Am I missing

> 2. It's less sensitive to the various formatting flags, some of
> which (like width) would apply only to the very first item.
> Preparing a string first allows uniform treatment of each
> element. (And the width could apply to the whole printout.)
I would have thought the Right Way to do this was to respect the
formatting for the entire output operation rather than to ignore them
completely for consistency. In either case it seems unnecessary to
create a temporary stream.

On further inspection, I realise that these I/O operations are not at
all suited to sparse data types and haven't changed in a substantial way
for a very long time. Is anybody actually USING them for anything other
than toy problems?