title: Defining operator() function inside a struct
body: <p>While going through one of the tutorials in the Boost library on function wrappers <a href="http://www.boost.org/doc/libs/1_55_0/doc/html/function/tutorial.html" rel="noreferrer">here</a>, I came across the following code:</p>
  
  <pre><code>  1     boost::function&lt;float (int x, int y)&gt; f;
    2
    3     struct int_div {
    4         float operator() (int x, int y) const { return ((float)x)/y; }
    5     };
    6
    7
    8     int main()
    9     {
   10         f = int_div();
   11         cout &lt;&lt; f(5, 3) &lt;&lt; endl;
   12         return 0;
   13     }
  </code></pre>
  
  <p>I am trying to wrap my head around about defining a function (<code>operator()</code>) inside a struct, and then assigning the struct (using <code>()</code> ) to the function wrapper <code>f</code>.  Can someone please help me understand what is happening, as far as concepts, in lines 3-5 and 10.</p>