title: Resolving operator ambiguity
body: <p>I have the following map type...</p>
  
  <pre><code>std::map&lt;D3DXCOLOR, ID3DXMesh*&gt;
  </code></pre>
  
  <p>During compilation, xfunctional complains that it <strong>cannot resolve an ambiguity</strong> regarding the key type;</p>
  
  <pre><code>error C2593: 'operator &lt;' is ambiguous
  </code></pre>
  
  <p>The candidate operators detected by the compiler are as follows;</p>
  
  <ol>
  <li>built-in C++ operator&lt;(DWORD, DWORD)</li>
  <li>built-in C++ operator&lt;(FLOAT, FLOAT)</li>
  <li>built-in C++ operator&lt;(D3DCOLORVALUE, D3DCOLORVALUE)</li>
  </ol>
  
  <p>The D3DXCOLOR struct consists of 4 floats <strong>r</strong>, <strong>g</strong>, <strong>b</strong>, and <strong>a</strong> respectively but does not define a operator &lt;. It does however provide cast functions for DWORD FLOAT and  D3DCOLORVALUE, hence the entries in the candidate list. </p>
  
  <p>I am contemplating the best way to resolve this problem. I could write my own inline operator for D3DXCOLOR, wrap the colour inside a new class which provides its own operator &lt;, or is it possible to somehow hint to the compiler which implementation should be chosen from the list of candidates? The DWORD operator &lt; would meet my requirements adequately.</p>