This may have been a dumb question on one level: I copied those operators out of the example. Turns out when I delete them, the program compiles, but then when I call insert() I get a SIGSEGV in the STL headers, specifically stl_function.h line 519. The second arg is zero; the others look fine. <br>
<br>517&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _Result<br>518&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; operator()(_Arg1 __x, _Arg2 __y) const<br>519&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { return _M_ptr(__x, __y); }<br>520&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br><br>So I am back where I was: can I use KDTree&lt;&gt; in this manner? Is it intended?<br>
<br>Eric<br><br><div class="gmail_quote">On Thu, Apr 24, 2008 at 9:16 PM, Eric Fowler &lt;<a href="mailto:eric.fowler@gmail.com">eric.fowler@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have a toy app that is storing a set&lt;&gt; of pointers to a PlanePoint object, itself little more than a wrapper for {int x, y;}. <br><br>Since I am storing pointers I want to store pointers in my KDTree too. With that in mind, I wrote this: <br>

<br>//header PlanePoint.h: <br>class PlanePoint : blah blah .. <br><br>inline bool operator==(PlanePoint const * A, PlanePoint const * B);<br><br>//header main.cpp:<br>#include &quot;PlanePoint.h&quot;<br>typedef KDTree::KDTree&lt;2, PlanePoint*, std::pointer_to_binary_function&lt;PlanePoint*, int, double&gt; &gt; tree_type_ptr;<br>

<br>When I make I get this:<br>PlanePoint.h:24: error: &#39;bool operator==(const PlanePoint*, const PlanePoint*)&#39; must have an argument of class or enumerated type<br>PlanePoint.cpp:16: error: &#39;bool operator==(const PlanePoint*, const PlanePoint*)&#39; must have an argument of class or enumerated type<br>

<br>This is apparently rooted in some obscure C++&nbsp; - ism to the effect that you can&#39;t define operators for pointers, or some such thing. <br><br>What I want to know is, do we have a workaround? I could just make copies of my object in the kdtree but would like to avoid that if at all possible. <br>

<br>Thanks<br><font color="#888888"><br>Eric<br><br>
</font></blockquote></div><br>