This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PR 57779 New debug check
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: FranÃois Dumont <frs dot dumont at gmail dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 15 Jul 2013 14:01:55 -0700
- Subject: Re: PR 57779 New debug check
- References: <51DDC4A0 dot 6020008 at gmail dot com> <CAH6eHdS-X3B61M3+6NcYmiZ69Q80xda9JUMN7ciZgOC8=yZz8A at mail dot gmail dot com> <51DEE0A9 dot 9010809 at oracle dot com> <CAH6eHdQtkAqrDTsSQ5S7xE8P2ABK3JzOAuYNvAB7pxOGWprXSQ at mail dot gmail dot com> <51DF1291 dot 6040404 at gmail dot com> <CAH6eHdSdghzQ7NXQutXnVho6a=WVS-Dvnr37Q=myAEWVs2+JSA at mail dot gmail dot com> <CAH6eHdT=x7djoPSA1Ach9oeENEpz9WH8rGu5jSg4uiEwg+jowA at mail dot gmail dot com> <51E45AB2 dot 10000 at gmail dot com>
Hi,
Il giorno 15/lug/2013, alle ore 13:25, FranÃois Dumont <frs.dumont@gmail.com> ha scritto:
> Even if I still don't see what can goes wrong here I agree that in theory this is bad so here is another proposal that do not have this drawback. I also consider all your remarks I think except the Paolo remark about using std::greater. If I am playing with plain pointers why would I need to use std::less or std::greater ?
The issue is well known, see the uses in basic_string for example, and it's about discontiguous memory, etc. The Standard explicitly discusses this case where std::less & co are specified. In short, if for a target, eg '<' doesn't make sense for arbitrary pointers, std::less does anyway (in that case an appropriate std::less shall be provided of course)
Paolo