Finding all points within distance r of a given point

Olumide 50295 at web.de
Fri Dec 12 01:56:01 UTC 2008


I just had a colleague who's good at STL look at the error, and he made 
the following change to the example kdtree.hpp:

   //tree_type assigned;
   //assigned = src;
   tree_type assigned(src);

and commented out lines 1214 - 1238 of kdtree.hpp i.e.

       o << "meta node:   " << tree._M_header << std::endl;
       o << "root node:   " << tree._M_root << std::endl;

       if (tree.empty())
         return o << "[empty " << __K << "d-tree " << &tree << "]";

       o << "nodes total: " << tree.size() << std::endl;
       o << "dimensions:  " << __K << std::endl;

       typedef KDTree<__K, _Val, _Acc, _Dist, _Cmp, _Alloc> _Tree;
       typedef typename _Tree::_Link_type _Link_type;

       std::stack<_Link_const_type> s;
       s.push(tree._M_get_root());

       while (!s.empty())
         {
           _Link_const_type n = s.top();
           s.pop();
           o << *n << std::endl;
           if (_Tree::_S_left(n)) s.push(_Tree::_S_left(n));
           if (_Tree::_S_right(n)) s.push(_Tree::_S_right(n));
         }

Now the example compiles.







More information about the libkdtree-devel mailing list