<p>In <a href="https://github.com/mlpack/mlpack/pull/732#discussion_r72071029">src/mlpack/methods/cf/cf.hpp</a>:</p>
<pre style='color:#555'>&gt; +  {
&gt; +    //! Value of this recommendation.
&gt; +    double value;
&gt; +    //! Item of this recommendation.
&gt; +    size_t item;
&gt; +    //! Trivial constructor.
&gt; +    Candidate(double value, size_t item) :
&gt; +        value(value),
&gt; +        item(item)
&gt; +    {};
&gt; +    //! Compare the value of two candidates.
&gt; +    friend bool operator&gt;(const Candidate&amp; l, const Candidate&amp; r)
&gt; +    {
&gt; +      return l.value &gt; r.value;
&gt; +    };
&gt; +  };
</pre>
<p><a href="https://github.com/rcurtin" class="user-mention">@rcurtin</a> I think you see a difference in runtime between std::pair and SortStruct in: <a href="https://github.com/mlpack/mlpack/issues/712" class="issue-link js-issue-link" data-url="https://github.com/mlpack/mlpack/issues/712" data-id="163035605" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#712</a>  , because you use a pointer to function comparison parameter instead of a functor or an operator, as I can see in: <a href="https://github.com/mlpack/mlpack/pull/721/commits/640f3a7859ea8d400bc6fed6b4395c2291ba0259#diff-3a0c62f44f497b9857aed01fe81dc391L54" class="commit-link"><tt>640f3a7</tt>#diff-3a0c62f44f497b9857aed01fe81dc391L54</a><br>
I have read some documentation that says that functors can be inlined while pointer to function generally are not.<br>
For Candidate struct, I define an operator, that probably will be inlined by the compiler.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/732/files/57dd61f1d823f209c8d0f67fa69f8a8ae0669d18#r72071029">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFJR1W7KU9p7qkjetHOAeKZAHW9P3ks5qZMWZgaJpZM4JScnZ">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFFU7l1hNJTJcuErbch03M6BPJT3uks5qZMWZgaJpZM4JScnZ.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/732/files/57dd61f1d823f209c8d0f67fa69f8a8ae0669d18#r72071029"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>