Universal less<> for pointers in C++ standard
<p>Many times I needed a set of pointers. Every time that happens, I end up writing a less&lt;> implementation for a pointer type - cast two pointers to size_t and compare the results.</p>

<p>My question is - is that available in the standard? I could not find anything like that. Seems like common enough case...</p>

<p>Update: it seems that the upcoming standard fixes all of the problems with less&lt;> provided for pointer types and unordered_set included, too. In a few years this question will be moot.</p>

<p>In the mean time, the current standard has no "legal" solution to this, but size_t cast works.</p>

<p>Update for update: well, I'll be gobsmacked! Not only </p>

<pre><code>std::map&lt;void *, int, std::less&lt;void*&gt; &gt; myMap;
</code></pre>

<p>works, but even</p>

<pre><code>std::map&lt;void *, int &gt; myMap;
</code></pre>

<p>as well.</p>

<p>And that's in gcc 3.4.1 . I've been doing all the these casts for nothing, and litb is perfectly right. Even the section number he cites is exactly the same in the current standard. Hurray!</p>
