title: Why does including <map> cause the div function to be defined in the global namespace?
body: <p>Consider the following code block:</p>
  <pre><code>void foo(){
    int a = div(1,2);
  }
  </code></pre>
  <p>This normally will not compile, as the <code>div</code> function has not been declared. However, if I preceed the code with <code>#include &lt;map&gt;</code>, the code compiles. Why is <code>map</code> pulling in identifiers into the global namespace, and why the <code>div</code> function in particular? Is there a way to avoid this?</p>
  <p>[mcve]</p>
  <pre><code>#include &lt;map&gt;
  
  void foo(){
    int a = div(1,2);
  }
  
  int main()
  {
    foo();    
  }
  </code></pre>
  <p>live link - <a href="https://godbolt.org/z/Ye8rv4MTc" rel="nofollow noreferrer">https://godbolt.org/z/Ye8rv4MTc</a></p>
  <p>clang - <code>&lt;source&gt;:4:7: error: no viable conversion from 'div_t' to 'int'</code></p>
  <p>gcc - <code>&lt;source&gt;:4:11: error: 'div' was not declared in this scope</code></p>
  <p>MSVC - <code>&lt;source&gt;(4): error C2440: 'initializing': cannot convert from 'div_t' to 'int'</code></p>