<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 26 August 2013 19:00, Jeffrey Yasskin <span dir="ltr">&lt;<a href="mailto:jyasskin@google.com" target="_blank">jyasskin@google.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The library&#39;s running into problems because &lt; is unspecified on<br>
pointers that don&#39;t point to the same object. (C++14CD[expr.rel]p4)<br>
Naively, this restriction makes a bit of sense, since we can&#39;t give a<br>
particular answer for any two pointers, but it&#39;s causing problems for<br>
some generic library components. Specifically:<br>
<br>
std::map&lt;T*&gt; works because std::less has a special case for pointers.<br>
([comparisons]p14)<br>
<br>
std::map&lt;std::tuple&lt;T*&gt;&gt; gives undefined behavior because<br>
std::less&lt;tuple&gt; uses tuple&#39;s operator&lt;, which uses T*&#39;s operator&lt;.<br>
<br>
std::map&lt;std::optional&lt;T*&gt;&gt; goes back to defined behavior because we<br>
special-cased optional&#39;s operator&lt; to use std::less:<br>
[optional.relops]p4<br></blockquote><div><br>I have strong reasons to believe we&#39;ll see an NB comment proposing std::less<br>to be specialized for tuple&lt;T*&gt; and containers.  </div></div><br></div></div>