title: How to make set:: find() work for custom class objects?
body: <p>I'm a bit confused about using STL <code>set::find()</code> for a set of my own defined class objects.</p>
  
  <p>My class contains more than two items (3/4/5 etc.), so how can I overload <code>less</code> operator?</p>
  
  <p>I tried for 3 variable, which is as follows and working fine:</p>
  
  <pre><code>return( (a1.i &lt; a2.i) ||
      (!(a1.i &gt; a2.i) &amp;&amp; (a1.f &lt; a2.f)) ||
      (!(a1.i &gt; a2.i) &amp;&amp; !(a1.f &gt; a2.f) &amp;&amp; (a1.c &lt; a2.c)));
  </code></pre>
  
  <p>where, <code>a1</code>, and <code>a2</code> are class objects and (<code>i</code>, <code>f</code> and <code>c</code> are class members).</p>
  
  <p>Now I want to generalize this for n members, but my <code>find()</code> does not always work.</p>
  
  <p>I've been looking through STL's detailed documentation, trying to learn how <code>set::find()</code> is implemented, and why it needs less (<code>&lt;</code>) operator overloading.</p>
  
  <p>I referred to sgi and msdn documentation, but I could not find much about implementation details of <code>set::find()</code> there, either.</p>
  
  <p>What am I doing wrong in my <code>set::find()</code> implementation?</p>