This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: std::forward_list optim for always equal allocator
- From: Daniel Krügler <daniel dot kruegler at gmail dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 11 Sep 2017 07:44:03 +0200
- Subject: Re: std::forward_list optim for always equal allocator
- Authentication-results: sourceware.org; auth=none
- References: <c199ddfe-3292-f42e-a2ce-aa3ef92e5910@gmail.com> <f8941efc-9020-c64e-f31a-d4ca483f74a3@gmail.com> <20170908161940.GG4582@redhat.com> <45617be7-8df2-3e50-66de-81a71c3d5f62@gmail.com>
2017-09-11 7:12 GMT+02:00 François Dumont <frs.dumont@gmail.com>:
> When user declare a container iterator like that:
>
> std::forward_list<int>::iterator it;
>
> There is no reason to initialize it with a null node pointer. It is just an
> uninitialized iterator which is invalid to use except to initialize it.
While that is correct, for every forward iterator (and
std::forward_list<int>::iterator meets these requirements), it is also
required that a value-initialized iterator can be compared against
other initialized iterators, so this reduces the amount of freedom to
define a default constructor for such iterators even when used to
default-initialize. This is not meant as a showstopper argument, since
I have not fully understood of what you are planning, but just a
reminder.
- Daniel