[mlpack-git] [mlpack/mlpack] Heaps for mlpack! (#732)
Ryan Curtin
notifications at github.com
Fri Jul 22 11:54:55 EDT 2016
> + {
> + //! Value of this recommendation.
> + double value;
> + //! Item of this recommendation.
> + size_t item;
> + //! Trivial constructor.
> + Candidate(double value, size_t item) :
> + value(value),
> + item(item)
> + {};
> + //! Compare the value of two candidates.
> + friend bool operator>(const Candidate& l, const Candidate& r)
> + {
> + return l.value > r.value;
> + };
> + };
Yep, your concerns are 100% valid. Take a look at #712 where @lozhnikov and I researched different solutions to this same problem. `std::priority_queue` has a third template parameter---`Compare`---which you could use to specify either a lambda or a custom function for comparison, which would only compare the first element in the pair.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/732/files/57dd61f1d823f209c8d0f67fa69f8a8ae0669d18#r71901732
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160722/ac9d00a2/attachment.html>
More information about the mlpack-git
mailing list