[mlpack] 22/58: Avoid math::Range copy, although realistically gcc should be avoiding that anyway when it recognizes that the variable is effectively const.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Tue Sep 9 13:19:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 120e3ac31c343d386dfaa6352bf0b5555a7397de
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Tue Aug 19 01:01:35 2014 +0000

    Avoid math::Range copy, although realistically gcc should be avoiding that
    anyway when it recognizes that the variable is effectively const.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17070 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
index 75e5a1b..126f232 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
@@ -461,7 +461,7 @@ void RTreeSplit<DescentType, StatisticType, MatType>::AssignNodeDestNode(
       {
         // For each of the new rectangles, find the width in this dimension if
         // we add the rectangle at index to the new rectangle.
-        math::Range range = oldTree->Children()[index]->Bound()[i];
+        const math::Range& range = oldTree->Children()[index]->Bound()[i];
         newVolOne *= treeOne->Bound()[i].Contains(range) ?
             treeOne->Bound()[i].Width() : (range.Contains(treeOne->Bound()[i]) ?
             range.Width() : (range.Lo() < treeOne->Bound()[i].Lo() ?

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list