Boost logo

Boost Users :

Subject: Re: [Boost-users] A forward iterator need not be default-constructible
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2011-09-30 12:08:55


> There's nothing in the standard to say that an uninitialized variable must
> be equal to itself.
>
> Especially since the standard states that the only defined operation on a
> singular iterator is ... assignment.

Again, I'm not talking about the standard. I'm talking about basic expectations.

> If a clever compiler computed the lifespan of all memory usage, is there
> anything in the standard which would keep it from using the memory of
> Singular Iterators as temporary storage? Or randomly bit-twiddling the bits
> in them while they are Singular?

I think any argument that starts with the phrase "If a clever..." is
automatically suspect. There are lots of clever things that might be
done, but I wonder at what cost. Would you trust your hypothetical
compiler to get lifetime right? Do you really want this compiler to
modify values behind your back?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net