Yes, this was cleaner, tested and committed this way.
2013-08-30 François Dumont <fdum...@gcc.gnu.org>
PR libstdc++/58148
* include/debug/functions.h (__foreign_iterator_aux4): Use
sequence const_pointer as common type to compare pointers. Add a
fallback overload in case pointers cannot be cast to sequence
const_pointer.
* testsuite/23_containers/vector/modifiers/insert/58148.cc: New.
François
On 08/30/2013 11:44 AM, Paolo Carlini wrote:
Hi,
On 08/29/2013 09:37 PM, François Dumont wrote:
Indeed, I check the Standard about const_pointer, so here is another
attempt.
Tested under Linux x86_64.
2013-08-29 François Dumont <fdum...@gcc.gnu.org>
PR libstdc++/58148
* include/debug/functions.h (__foreign_iterator_aux4): Use
sequence const_pointer as common type to compare pointers. Add a
fallback overload in case pointers cannot be cast to sequence
const_pointer.
* testsuite/23_containers/vector/modifiers/insert/58148.cc: New.
Ok to commit ?
Seems pretty good to me. I have been thinking: when the non-trivial
__foreign_iterator_aux4 is selected it actually has available as the
last two arguments
std::addressof(*(__it._M_get_sequence()->_M_base().begin()))
std::addressof(*__other)
we could as well give the parameters names and avoid passing __other.
Also, I think we can do everything with std::less. I'm attaching below
something I quickly hacked, untested, see if you like it in case
commit something similar.
Thanks!
Paolo.
//////////////////////