Why is std::less better than "<"? : <p>C++ primer, 5th, 14.8.2, Using a Library Function Object with the Algorithms:</p>

<pre><code>vector&lt;string *&gt; nameTable;  // vector of pointers
// error: the pointers in nameTable are unrelated, so &lt; is undefined
sort(nameTable.begin(), nameTable.end(),
     [](string *a, string *b) { return a &lt; b; });
// ok: library guarantees that less on pointer types is well defined
sort(nameTable.begin(), nameTable.end(), less&lt;string*&gt;());
</code></pre>

<p>Then I checked the std::less implementation:</p>

<pre><code>template&lt;typename _Tp&gt;
struct less : public binary_function&lt;_Tp, _Tp, bool&gt;
{
  bool
  operator()(const _Tp&amp; __x, const _Tp&amp; __y) const
  { return __x &lt; __y; }
};
</code></pre>

<p>I found out that std::less also use operator &lt; to do the work, so why &lt; is undefined and library guarantees that less on pointer types is well defined, why is std:less recommended, and why is std::less better than &lt;.</p>
