Boost logo

Boost :

From: rwgk (rwgk_at_[hidden])
Date: 2002-03-07 18:26:56


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> vector<int> x(100000);
> int y = x[0]; // undefined behavior

I am not proposing to change the behavior of vector<int> x(100000);
See my previous posting (if it shows up in the system
before the end of the week...).

This is what I am proposing:

std::vector<int> x(100000, std::uninitialized_flag());
int y = x[0]; // programming error

> > Also, I cannot believe that an array package must be 120000
> > lines long (Blitz++), in part to make the implementation of
> > map<int, int> simpler.
>
> I can't believe that Blitz++ spends any significant fraction of
those
> lines avoiding initialization.

Good point.
But don't the expression templates constitute a major fraction of
the code? Isn't that Todd's way of getting around the initialization
problem?
Going off on a tangent: the array family algebra does not avoid the
temporaries, but it works around the initialization problem. I have
not done any timings, but I suspect (well, hope) that the performance
penalty with respect to Blitz++ is small.
Ralf


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