node is whatever you store in the tree...<br><br>so in this case its pretty easy<br><br>
struct not_me<br>
{<br>shared_ptr<A> me;<br> not_me(shared_ptr<A> m) : me(m) {}<br><br>
bool operator()( shared_ptr<A> const& n ) const { return n != me; }<br>
};<br>
<br><br><div class="gmail_quote">2008/7/11 Gonsolo <<a href="mailto:gonsolo@gmail.com">gonsolo@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!<br>
<br>
Paul Harris schrieb:<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I use a find_nearest_if() call, and pass a functor that confirms that the<br>
node is NOT the target node.<br>
<br>
eg, you could check it against a pointer, or in this case an ID.<br>
you have to be careful with the pointer approach as you have to be careful<br>
to find the right pointer (the address of the node that is stored in the<br>
tree) ...<br>
<br>
eg with id<br>
struct not_me<br>
{<br>
int id;<br>
not_me(int id) : id(id) {}<br>
bool operator()( Node const& n ) const { return <a href="http://n.id" target="_blank">n.id</a> != id; }<br>
};<br>
<br>
found = kdtree.find_nearest_if( ... , not_me(<a href="http://target.id" target="_blank">target.id</a>) );<br>
</blockquote>
<br></div>
Thank you very much. I tried that but I still do not get it.<br>
What is that Node? In kdtree's source I find _Node.<br>
<br>
I have something like:<br>
<br>
class A {};<br>
<br>
typedef KDTree::KDTree<3, boost::shared_ptr<A>, std::pointer_to_binary_function< shared_ptr<A>,int,double> > kdtree;<br><font color="#888888">
<br>
g<br>
</font></blockquote></div><br>