title: C++ - Map of pairs - check if a pair with given first coordinate exists
body: <p>I'm holding a map sorted on <code>std::pair&lt;K, V&gt;</code>. (It's type is <code>std::map&lt;std::pair&lt;K, V&gt;, size_t&gt;</code>). I want to find ANY pair with given first coordinate (i.e. with <code>K</code> fixed, find if there is any object in map, with key of form <code>std::pair&lt;K, _&gt;</code>, I don't care about the second coordinate). Obviously it can be done in O(log n), as searching specific pair is also done in O(log n) [that's standard find() operation]. Is there some way to do that without having to write my own map from scratch?</p>
  
  <p>One more thing - I can't change comparing function, as I want pairs like <code>(1,2), (1,3)</code> to be different, and if comparator compares keys only, it will treat them as equals. I want to preserve standard find() operation, as I need to use it as well.</p>
  
  <p>The solution from <a href="https://stackoverflow.com/questions/34577818/finding-any-element-with-specific-first-coordinate-in-setpair">Finding any element with specific first coordinate in <code>set&lt;pair&gt; &gt;</code></a> will not work as I have only guarantee that <code>operator &lt;</code> is provided for both <code>K</code> and <code>V</code>.  I do not know if <code>std::numeric_limits</code> is specialized for <code>K</code></p>