This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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>
          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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]