<p>One of the keys of the refactoring I did for serialization is that I attempted to keep the interfaces using references, and not pointers, for the sake of simplicity.  i.e.</p>

<pre><code>RMSPROP(DecomposableFunctionType* function,
          const double lr = 0.01,
          const double alpha = 0.99,
          const double eps = 1e-8) :
      function(&amp;function),
      lr(lr),
      alpha(alpha),
      eps(eps)
</code></pre>

<p>I guess this would make the call to <code>new OptimizerType&lt;&gt;</code> take <code>*this</code> instead of <code>this</code>.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/513#issuecomment-178034886">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFJw8Ifx9x3Y4XL3S_XZ9VG-APXv4ks5pf3WjgaJpZM4HQHGn.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/513#issuecomment-178034886"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>