title: Is there an advantage to using pointers or references to return Boost matrices?
body: <p>I'm using Boost to do some matrix algebra.  I'm trying to understand if this optimization does anything.  Original:</p>
  
  <pre><code>matrix&lt;double&gt; DoSomething(matrix&lt;double&gt; a, matrix&lt;double&gt; b)
  {
      return a + b; //for example
  }
  </code></pre>
  
  <p>Optimization:</p>
  
  <pre><code>matrix&lt;double&gt;* DoSomething(matrix&lt;double&gt;* a, matrix&lt;double&gt;* b)
  {
      return *a + *b; //for example
  }
  </code></pre>
  
  <p>Basically, I assumed that using pointers as the parameters and the return type would prevent copying a large object.  After reading through the source code, I'm wondering if Boost ublas basically takes care of this.  It seems like you're always dealing with a reference in Boost's code.</p>