title: How to insert into STL set?
body: <p>I'm having problems and I'm not sure I understand the STL documentation. Let's say I have this:</p>
  <pre><code>#include &lt;set&gt;
  ...
  
  struct foo
  {
      int bar;
  };
  
  struct comp
  {
      inline bool operator()(const foo&amp; left,const foo&amp; right)
      {
          return left.bar &lt; right.bar;
      }
  };
  
  int main()
  {
      std::set&lt;foo,comp&gt; fooset;  // Uses comparison struct/class object comp to sort the container
  
      ...
  
      return 0;
  }
  </code></pre>
  <p>How do I insert struct <code>foo</code>s into the <code>set</code> using my own comparator struct?</p>