<p>Thank you for your replies. After reading a bunch on tie and tuple I think I understand what they do. I changed my code to create the models using std::make_tuple instead of std::tie as shown:</p>

<pre><code>auto modules = std::make_tuple(inputLayer, inputBiasLayer, inputBaseLayer, hiddenLayer1, hiddenBiasLayer1, outputLayer);
ann::FFN&lt;decltype(modules), decltype(classOutputLayer), ann::RandomInitialization, PerformanceFunctionType&gt; net(modules, classOutputLayer);

</code></pre>

<p>I have the function return type auto and I return the variable net after training the network. In the main function I save it to another auto'd variable and call predict on it:</p>

<pre><code>auto net = BuildFFN&lt;ann::LogisticFunction, ann::BinaryClassificationLayer, ann::MeanSquaredErrorFunction&gt;
        (trainData, trainLabels, testData, testLabels, hiddenLayerSize);

arma::mat prediction;
net.Predict(testData, prediction);

</code></pre>

<p>I also made sure that ARMA_USE_CXX11 was enable (after checking out how to do it <a href="http://stackoverflow.com/questions/33366730/armadillo-initializer-list-is-not-working">here</a>):</p>

<pre><code>#if !defined(ARMA_USE_CXX11)
#define ARMA_USE_CXX11
//// Uncomment the above line if you have a C++ compiler that supports the C++11 standard
//// This will enable additional features, such as use of initialiser lists
#endif
</code></pre>

<p>However, the compiler doesn't like this, it spit out a huge amount of error:</p>

<pre><code>In file included from /usr/include/c++/4.8/functional:55:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/boost/math/tools/config.hpp:16,
                 from /usr/include/boost/math/tools/series.hpp:16,
                 from /usr/include/boost/math/special_functions/gamma.hpp:17,
                 from /usr/local/include/mlpack/prereqs.hpp:32,
                 from /usr/local/include/mlpack/core.hpp:190,
                 from /home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:4:
/usr/include/c++/4.8/tuple: In instantiation of ‘constexpr std::_Head_base&lt;_Idx, _Head, false&gt;::_Head_base(const _Head&amp;) [with long unsigned int _Idx = 3ul; _Head = mlpack::ann::LinearLayer&lt;&gt;]’:
/usr/include/c++/4.8/tuple:257:44:   recursively required from ‘constexpr std::_Tuple_impl&lt;_Idx, _Head, _Tail ...&gt;::_Tuple_impl(const _Head&amp;, const _Tail&amp; ...) [with long unsigned int _Idx = 1ul; _Head = mlpack::ann::BiasLayer&lt;&gt;; _Tail = {mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;}]’
/usr/include/c++/4.8/tuple:257:44:   required from ‘constexpr std::_Tuple_impl&lt;_Idx, _Head, _Tail ...&gt;::_Tuple_impl(const _Head&amp;, const _Tail&amp; ...) [with long unsigned int _Idx = 0ul; _Head = mlpack::ann::LinearLayer&lt;&gt;; _Tail = {mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;}]’
/usr/include/c++/4.8/tuple:400:33:   required from ‘constexpr std::tuple&lt; &lt;template-parameter-1-1&gt; &gt;::tuple(const _Elements&amp; ...) [with _Elements = {mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;}]’
/usr/include/c++/4.8/tuple:864:62:   required from ‘constexpr std::tuple&lt;typename std::__decay_and_strip&lt;_Elements&gt;::__type ...&gt; std::make_tuple(_Elements&amp;&amp; ...) [with _Elements = {mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;}]’
/home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:42:123:   required from ‘auto BuildFFN(MatType&amp;, MatType&amp;, MatType&amp;, MatType&amp;, size_t) [with PerformanceFunction = mlpack::ann::LogisticFunction; OutputLayerType = mlpack::ann::BinaryClassificationLayer; PerformanceFunctionType = mlpack::ann::MeanSquaredErrorFunction; MatType = arma::Mat&lt;double&gt;; size_t = long unsigned int]’
/home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:79:71:   required from here
/usr/include/c++/4.8/tuple:135:25: error: use of deleted function ‘mlpack::ann::LinearLayer&lt;&gt;::LinearLayer(const mlpack::ann::LinearLayer&lt;&gt;&amp;)’
       : _M_head_impl(__h) { }
                         ^
In file included from /home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:12:0:
/usr/local/include/mlpack/methods/ann/layer/linear_layer.hpp:30:7: note: ‘mlpack::ann::LinearLayer&lt;&gt;::LinearLayer(const mlpack::ann::LinearLayer&lt;&gt;&amp;)’ is implicitly declared as deleted because ‘mlpack::ann::LinearLayer&lt;&gt;’ declares a move constructor or move assignment operator
 class LinearLayer
       ^
In file included from /usr/include/c++/4.8/functional:55:0,
                 from /usr/include/c++/4.8/bits/stl_algo.h:66,
                 from /usr/include/c++/4.8/algorithm:62,
                 from /usr/include/boost/math/tools/config.hpp:16,
                 from /usr/include/boost/math/tools/series.hpp:16,
                 from /usr/include/boost/math/special_functions/gamma.hpp:17,
                 from /usr/local/include/mlpack/prereqs.hpp:32,
                 from /usr/local/include/mlpack/core.hpp:190,
                 from /home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:4:
/usr/include/c++/4.8/tuple: In instantiation of ‘constexpr std::_Head_base&lt;_Idx, _Head, false&gt;::_Head_base(const _Head&amp;) [with long unsigned int _Idx = 0ul; _Head = mlpack::ann::LinearLayer&lt;&gt;]’:
/usr/include/c++/4.8/tuple:257:44:   required from ‘constexpr std::_Tuple_impl&lt;_Idx, _Head, _Tail ...&gt;::_Tuple_impl(const _Head&amp;, const _Tail&amp; ...) [with long unsigned int _Idx = 0ul; _Head = mlpack::ann::LinearLayer&lt;&gt;; _Tail = {mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;}]’
/usr/include/c++/4.8/tuple:400:33:   required from ‘constexpr std::tuple&lt; &lt;template-parameter-1-1&gt; &gt;::tuple(const _Elements&amp; ...) [with _Elements = {mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;}]’
/usr/include/c++/4.8/tuple:864:62:   required from ‘constexpr std::tuple&lt;typename std::__decay_and_strip&lt;_Elements&gt;::__type ...&gt; std::make_tuple(_Elements&amp;&amp; ...) [with _Elements = {mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::LinearLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BiasLayer&lt;arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;, mlpack::ann::BaseLayer&lt;mlpack::ann::LogisticFunction, arma::Mat&lt;double&gt;, arma::Mat&lt;double&gt; &gt;&amp;}]’
/home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:42:123:   required from ‘auto BuildFFN(MatType&amp;, MatType&amp;, MatType&amp;, MatType&amp;, size_t) [with PerformanceFunction = mlpack::ann::LogisticFunction; OutputLayerType = mlpack::ann::BinaryClassificationLayer; PerformanceFunctionType = mlpack::ann::MeanSquaredErrorFunction; MatType = arma::Mat&lt;double&gt;; size_t = long unsigned int]’
/home/sudarshan/project-yanack/mlpack_nn/src/ff_nn.cpp:79:71:   required from here
/usr/include/c++/4.8/tuple:135:25: error: use of deleted function ‘mlpack::ann::LinearLayer&lt;&gt;::LinearLayer(const mlpack::ann::LinearLayer&lt;&gt;&amp;)’
       : _M_head_impl(__h) { }
                         ^
make[2]: *** [CMakeFiles/ff_nn.dir/src/ff_nn.cpp.o] Error 1
make[1]: *** [CMakeFiles/ff_nn.dir/all] Error 2
make: *** [all] Error 2

</code></pre>

<p>Based on what I can infer from this, it seems that the layers are references and making a tuple out of this is not working (I could be wrong). </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/531#issuecomment-191236445">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFKhkyUDmEpbdP3SdOYAAGcOpJ40_ks5ppY78gaJpZM4HmbCC.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-191236445"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>