On 18 apr, 15:27, "Leigh Johnston" <le...@i42.co.uk> wrote:
Yes and even within the context you are talking about Alf disagreed
with the
fact that the code was wrong. Code that does not invoke UB is not
necessarily correct. In this particular case the merits of the code
which I
presented can be considered in isolation.
I totally agree with Pete.
Context was that OP was seeking RAII without zero-initializing memory
space, since the performance issues on specific platform. Suggestion
to use vector was yours.
Alf claimed that yes, reserve()'d raw space can be used without
causing UB and RAII works and no zero-initialization, exactly like OP
wanted.
Silly code posted here was also yours.
Alf again said that yes, it works everywhere without causing UB.
Now you totally go out of limits claiming that the code was meant as
some sort of example how to use vectors.