[mlpack-git] [mlpack/mlpack] Use move semantics to set a given reference tree in NeighborSearch class. (#743)

MarcosPividori notifications at github.com
Thu Jul 28 16:51:17 EDT 2016


Hi,

I have modified NeighborSearch class to take a rvalue reference instead of pointer, when setting a specific referenceTree, for the constructor and Train() method.
I think this is more intuitive. We use these methods when we want to build the reference tree with a special configuration, for example to set the leafSize.
Every time we use these methods, we want to transfer ownership of this tree to the neighbor search class, so I think a rvalue reference is more appropiate.
These changes are not completed, we should add a move constructor for all rtrees's flavours. I wanted to be sure you are interested in this, before spending more time.

Another option is to continue using the pointer to referenceTree and incorporate a boolean parameter like:  "setOwnership".
Personally, I prefer rvalues references for this case.

Thanks!
You can view, comment on, or merge this pull request online at:

  https://github.com/mlpack/mlpack/pull/743

-- Commit Summary --

  * Documentation details.
  * Add move constructor for cover tree.
  * Update knn test to use rvalue references.
  * Update kfn test to use rvalue references.

-- File Changes --

    M src/mlpack/core/tree/cover_tree/cover_tree.hpp (8)
    M src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp (40)
    M src/mlpack/methods/neighbor_search/neighbor_search.hpp (15)
    M src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp (18)
    M src/mlpack/methods/neighbor_search/ns_model_impl.hpp (9)
    M src/mlpack/tests/akfn_test.cpp (4)
    M src/mlpack/tests/kfn_test.cpp (36)
    M src/mlpack/tests/knn_test.cpp (39)

-- Patch Links --

https://github.com/mlpack/mlpack/pull/743.patch
https://github.com/mlpack/mlpack/pull/743.diff

---
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/743
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160728/904487a0/attachment.html>


More information about the mlpack-git mailing list