title: C++ default copy/move assignment operator for extern C structure not const
body: <p>I have a <code>std::map&lt;CXCursor, DeclarationContent&gt;</code> from which I want to remove elements using <code>std::remove_if</code>.</p>
  
  <p><code>CXCursor</code> is a (typedef of a) struct in external C code (libClang) that I cannot / must not modify.</p>
  
  <p>Error messages from clang++ 3.4.2 --std=c++11 :</p>
  
  <pre><code>stl_pair.h:170:8: error: no viable overloaded '='
  stl_algo.h:1152:23: note: in instantiation of member function std::pair&lt;const CXCursor, DeclarationContent&gt;::operator=' requested here
  
  extract.cc:34:8: in instantiation of function template specialization 'std::remove_if&lt;std::_Rb_tree_iterator&lt;std::pair&lt;const CXCursor, DeclarationContent&gt; &gt;, bool (*)(std::pair&lt;const CXCursor, DeclarationContent&gt; &amp;)&gt;' requested here
    std::remove_if(decls.begin(), decls.end(), noCodeGenerationRequested);
  
  include/clang-c/Index.h:2137:9: note: candidate function (the implicit copy assignment operator) not viable:
    'this' argument has type 'const CXCursor', but method is not marked const
  
  /include/clang-c/Index.h:2137:9: note: candidate function (the implicit move assignment operator) not viable:
    'this' argument has type 'const CXCursor', but method is not marked const
  </code></pre>
  
  <p>The code is basically:</p>
  
  <pre><code>std::map&lt;CXCursor, DeclarationContent&gt; decls;
  // filling the map
  std::remove_if(decls.begin(), decls.end(), noCodeGenerationRequested);
  </code></pre>
  
  <p>with</p>
  
  <pre><code>bool noCodeGenerationRequested(std::map&lt;CXCursor, DeclarationContent&gt;::value_type &amp; v)
  { /* FUN GOES HERE */ return true; }
  </code></pre>
  
  <p>From reading the error message it seems that the implicit assignment operators are not const qualified, which is needed in case of a map (as it's key is always const).</p>
  
  <p><s>I could write a wrapper class around CXCursor that provides those assignment operators</s>, but maybe there is another way?</p>
  
  <hr>
  
  <p><code>std::remove_if</code> does not work with a <code>std::map</code>, see: <a href="https://stackoverflow.com/q/800955/1116364">remove_if equivalent for std::map</a></p>