<blockquote>
<p>which would result in a single parameter we have to pass to the performance function.</p>
</blockquote>
<p>I think both designs have their pros and cons</p>
<p>Implementing SparseCost function, and I find out the Error function need one more parameter--error</p>
<pre><code>double Error(const DataType&, const DataType&, const DataType &error)
</code></pre>
<p>The problem is FNN call the function as following</p>
<pre><code>return performanceFunc.Error(
std::get<sizeof...(Tp) - 1>(t).OutputParameter(), target);
</code></pre>
<p>But I need the error parameter</p>
<pre><code>return performanceFunc.Error(
std::get<sizeof...(Tp) - 1>(t).OutputParameter(), target, error);
</code></pre>
<p>Now there are two solutions in my mind </p>
<p>1 : make all of the Error function accept one more parameter<br>
2 : Use SFINAE to determine which function to called</p>
<p>a : declare a traits <br>
HAS_MEM_FUNC(Error, HasErrorCheck);<br>
b : use SFINAE to select appropriate function at compile time</p>
<pre><code>typename std::enable_if<
HasErrorCheck<T, double(T::*)(const U&, const U&, const U&)>::value, double>::type
</code></pre>
<p>I prefer solution 1, what is your opinion?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/pull/451#issuecomment-163724808">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFMjzgL3r2LMD8ExkkIjudV_L5BADks5pOci0gaJpZM4GAqt4.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/pull/451#issuecomment-163724808"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>