title: Writing a template that can use a std::vector or a std::set
body: <p>I've written an asynchronous job queue class which has been working nicely for ages.  It uses a <code>std::vector</code> as the underlying collection to keep jobs in and then processes them later as you might expect.  When I add a job it does a <code>push_back</code> on this <code>vector</code>.</p>
  
  <p>Recently I decided that I wanted to templatize the underlying collection type that it uses and the with way I've written it, this should be very simple.  It's now declared thus:</p>
  
  <pre><code>template&lt;typename J, typename CollectionT = std::vector&lt;J&gt;&gt;
  class async_jobqueue
  {
  public:
  </code></pre>
  
  <p>There's just one snag, for vectorish type containers I want to push things onto the end of the collection and call <code>push_back</code>, for settish type containers I'll want to call <code>insert</code>.  How can I make a compile decision about which to call?  Or is there a handy adapter I can use?</p>