title: tr1::bind & pass by reference, is this behavior really expected?
body: <p>Given the following test code</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;tr1/functional&gt;
  using namespace std;
  
  struct cl { 
    cl(){ cout &lt;&lt; "  cl()\n"; } 
    cl(const cl&amp; from){ cout &lt;&lt; "  cl()[copy]\n"; } 
    ~cl(){ cout &lt;&lt; "  ~cl()\n";}
  };
  void  f1(const cl&amp; data){}
  void  f2(const cl* pData){}
  
  int main(int c, char** a)
  {
    cout &lt;&lt; "enter:\n";
    cl data;
    cout &lt;&lt; "ref:\n";
    tr1::bind(&amp;f1, data);
    cout &lt;&lt; "ptr:\n";
    tr1::bind(&amp;f2, &amp;data);
    cout &lt;&lt; "exit:\n";
    return 0;
  }
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>$ g++ tr1BindDtorTest.cpp &amp;&amp; ./a.out
  enter:
    cl()
  ref:
    cl()[copy]
    cl()[copy]
    cl()[copy]
    ~cl()
    ~cl()
    ~cl()
  ptr:
  exit:
    ~cl()
  </code></pre>
  
  <p>When I create a binding involving references to my class/struct objects are created and destroyed multiple times.</p>
  
  <p>Same exact test but with pointers there are no such objects</p>
  
  <p>I can't see why the behaviour will be different between pass by value &amp; reference, I always thought of reference as syntactic sugar for pointer, and so reasoned that the behaviours should be identical.</p>
  
  <p>Anyone care to explain?</p>
  
  <p>[g++ 4.4.6 linux &amp; 4.2.1 on macos]</p>