title: C++ std::set update is tedious: I can't change an element in place
body: <p>I find the update operation on <code>std::set</code> tedious since there's no such an API on <a href="http://en.cppreference.com/w/cpp/container/set" rel="noreferrer">cppreference</a>. So what I currently do is something like this:</p>
  
  <pre><code>//find element in set by iterator
  Element copy = *iterator;
  ... // update member value on copy, varies
  Set.erase(iterator);
  Set.insert(copy);
  </code></pre>
  
  <p>Basically the iterator return by <code>Set</code> is a <code>const_iterator</code> and you can't change its value directly.</p>
  
  <p>Is there a better way to do this? Or maybe I should override <code>std::set</code> by creating my own (which I don't know exactly how it works..)</p>