title: Adding element to back of STL container
body: <p>I'm looking for a general way of adding an element to the back of an STL container.  I would like the code to support as many types of STL container as possible.  The following piece of code demonstrates my problem:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  template&lt;typename T&gt;
  class S {
    T built;
    typename T::iterator built_it;
  public:
    S() : built{}, built_it{built.end()} {}
    void add_to(typename T::value_type e) {
      built.emplace(built_it, e);
      ++built_it;
    }
    const T&amp; get() {
      return built;
    }
  };
  
  int main()
  { 
    S&lt;std::vector&lt;int&gt;&gt; e;
    S&lt;std::string&gt; f;
    e.add_to(3);   // works
    f.add_to('c'); // doesn't
  }
  </code></pre>
  
  <p>The problem here is subtle.  This code works great for <code>vector</code>s, because <code>std::vector</code> implements the <code>emplace</code> function.  But <code>std::string</code> does not!  Is there a more general way to perform the same operation?</p>