<p>As <code>tie</code> copies references not objects you cannot return a tuple that is created from a <code>tie</code> using objects on stack.  However using <code>make_tuple</code> copies objects. Hence you return such tuples from functions. However you need to know the exact type of tuple. The type of RNN in the recurrent_network_test is:<br>
RNN&lt;<br>
std::tuple&lt;<br>
          LinearLayerarma::mat,arma::mat &amp;,<br>
          RecurrentLayerarma::mat,arma::mat &amp;,<br>
          BaseLayer &amp;,<br>
          LinearLayerarma::mat,arma::mat &amp;,<br>
         BaseLayer &amp;<br>
         &gt;,<br>
 BinaryClassificationLayer,<br>
RandomInitialization,<br>
MeanSquaredErrorFunction</p>

<blockquote>
<p>If you are using C++14 though you can declare the return type as <code>auto</code>. Hence you could create a model <br>
<code>auto BuildNetwork(...) { return FNN(make_tuple(...),..) }</code><br>
In fact I wrote serialization code before I considered copy construction. But then I had to cut and paste code from the training module to the test module.</p>
</blockquote>

<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/531#issuecomment-190913778">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFBgjM9zq4KebiRi3NURcX8BBcGLuks5ppLAtgaJpZM4HmbCC.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/531#issuecomment-190913778"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>