[Patch] Qualify less() and min() in basic_string.h

Paolo Carlini pcarlini@unitus.it
Mon Dec 2 11:23:00 GMT 2002


Gabriel Dos Reis wrote:

>This is unnecessary, but I guess it won't make any ill.  Koenig lookup
>is not done on template-ids, and here there is no way it would resolve
>to anything but std::less.  But your patch looks good.
>
>At Santa Cruz Benjamin and I agreed that in this case, we should be
>using our own "less" function objects -- crafted in our implementation
>namespace.  I have a patch for that, but I'm waiting for mainline
>unfreezing before applying it.
>
>Basically, it reads:
>
>   namespace __gnu_cxx
>   {
>      struct __less {
>         template<typename _Tp>
>           bool
>           operator()(const _Tp& __x, const _Tp& __y) const
>           { return __x < __y; }
>      };
>   }
>
>We can use that to reduce to half the size of files like stl_algo_, base}.h
>that duplicate codes.
>
Thanks, both for technical point on Koenig lookup (I didn't know about 
it, sorry)
and the update on the less function objects. Everything considered, I 
think it's better to commit
only the min() hunk of the patch.

Ciao, Paolo.



More information about the Libstdc++ mailing list