This is the mail archive of the
mailing list for the libstdc++ project.
Thomas Kunert <email@example.com> writes:
| One problem for me at least is, the current state of affairs
| makes vector::iterator useless in many circumstances. Say
| you are given some vector
| vector<double> v;
| and you want to apply some algorithm, e.g. sort, on it.
| The easiest code to do that is
| sort( v.begin(), v.end() );
| but given the current definition of the iterator paired with
| unreliable optimization in the compiler this code is simply
| irresponsible and deserves forbidden. What you have to write
| is of course
>From my point of view, the problem is in the compiler not in the
library. The above example is not the kind of argument that will
change my take on this. We have better gains by improving the
compiler, not removing type safety and adding other kind of kludges.
Once you start removing that simple structure, you would also have to
remove object functions and any other bonus for the same reason.
That is a wrong-headed road.
The right thing to do is to explain middle-end people that not just
because you use a structure means you don't mind about performance.
No. Use of the structure is just way of annotating your programm.
They should not focuse on the medium, instead they should focuse on
the message, i.e. the data. If an integer can fit into a register
then a structure containing that integer should be made to fit into a
register. Use of structure does not meant "don't put this in a