Note on the MS VC 2005, I've already come across and resolved some of problems in my copy. <br><br>See below for notes<br><br><br><div class="gmail_quote">2008/11/11 Sylvain Bougerel <span dir="ltr"><<a href="mailto:sylvain.bougerel.devel@gmail.com">sylvain.bougerel.devel@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Tue, Nov 11, 2008 at 2:19 AM, Sam Hayne <<a href="mailto:Sam.Hayne@gmx.de">Sam.Hayne@gmx.de</a>> wrote:<br>
> Hello! :)<br>
<div class="Ih2E3d">><br>
><br>
> As the posting is a bit longer, a short summary:<br>
><br>
><br>
> =====================================<br>
> 1) compiler errors in VC2005 + solution<br>
</div><div class="Ih2E3d">> =====================================<br>
><br>
> allocator.hpp:<br>
><br>
> typedef confusion<br>
><br>
> error: kdtree++/kdtree.hpp(95) : error C2059: syntax error : '<'<br>
><br>
> solved by:<br>
> rename all _Node to e.g. _Node_Ab in this file starting from line 21:<br>
><br>
> old: typedef typename _Node<_Tp> _Node;<br>
> new: typedef typename _Node<_Tp> _Node_Ab;<br>
><br>
<br>
</div>Okay, that's not nice, although I think that VC++ does not respect the<br>
standard here, we should still make the library portable.<br>
<br>
Just one question? why did you put _Ab as a suffix? A particular reason?<br>
<div class="Ih2E3d"></div></blockquote><div><br>Its to do with multiple definitions of the same type, IIRC<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
><br>
> node.hpp:<br>
><br>
> confusion:<br>
> reserved #defines (in windef.h) "near" and "far" used as variable names:<br>
> => rename near and far to something like near_N and far_N, starting from<br>
> line 337<br>
><br>
<br>
</div>Ah yeah, I remember dealing with something like that once. Hum, well,<br>
it should be changed too, I guess.<br>
<div class="Ih2E3d"></div></blockquote><div><br>i don't remember seeing this one<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
><br>
><br>
> iterator.hpp:<br>
><br>
> error: error C2248: 'KDTree::_Iterator<_Val,_Ref,_Ptr>::operator *' : cannot<br>
> access private member declared in class 'KDTree::_Iterator<_Val,_Ref,_Ptr>'<br>
><br>
> solved by:<br>
><br>
> add "public:" in line 110:<br>
><br>
> template <typename _Val, typename _Ref, typename _Ptr><br>
> class _Iterator : protected _Base_iterator<br>
> {<br>
> public: //added<br>
> typedef _Val value_type;<br>
> ...<br>
><br>
><br>
</div></blockquote><div><br>I don't remember seeing this one either, maybe i did<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
</div>Ok I dunno weather it was g++ error of VC2005 error. But this rings a big:<br>
"DON'T DO THIS" bell in my mind.<br>
<div class="Ih2E3d"></div></blockquote><div class="Ih2E3d"><br>
><br>
><br>
> error C2247: 'KDTree::_Base_iterator::_M_node' not accessible because<br>
> 'KDTree::_Iterator<_Val,_Ref,_Ptr>' uses 'protected' to inherit from<br>
> 'KDTree::_Base_iterator'<br>
><br>
> solved by:<br>
><br>
> line 108: change "protected" to public<br>
> old: class _Iterator : protected _Base_iterator<br>
> new: class _Iterator : public _Base_iterator<br>
><br>
> (may be really bad though..)<br>
><br>
<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Same as above, ;-)<br>
<div class="Ih2E3d"><br>
><br>
><br>
> kdtree.hpp:<br>
><br>
> comment away "__throw_exception_again;" in line 1175 => unknown identifier<br>
><br>
<br>
</div>Ohla, okay this is not nice: I think we should not use it cause it's<br>
pure libstdc++ stuff. It should be equivalent in most case to a<br>
simple:<br>
throw;<br>
I'm gonna check why they use this in the library and not the above.<br>
<div class="Ih2E3d"></div></blockquote><div><br><br>i've actually made a patch for this, using a class constructor+destructor to do the cleanups automatically... thats what the try/catch/rethrow was for<br><br>i think i posted some of it on the mailing list just recently, its not in the git repository yet<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
><br>
><br>
> error in test_kdtree.cpp:<br>
><br>
> warning C4003: not enough actual parameters for macro 'max'<br>
> error C2589: '(' : illegal token on right side of '::'<br>
> error C2059: syntax error : '::'<br>
><br>
> caused by: *t.find_nearest(s,std::numeric_limits<double>::max()).first;<br>
><br>
> Solved by: Undefine min/max previously defined in windows.h:<br>
><br>
> #undef max;<br>
> #undef min;<br>
> triplet result =<br>
> *t.find_nearest(s,std::numeric_limits<double>::max()).first;<br>
><br>
><br>
</div></blockquote><div><br>yeah i've come across this a bunch of times, windows.h #defines min and max in some situations. this is a common problem not just for kdtree<br><br>one solution is to #include kdtree before windows.h, which may not be possible for your application.<br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
</div>Urg, this is really ugly... can you tell us why you actually had<br>
"windows.h" included here? Did you added it for some reason, or does<br>
it get included by another file?<br>
<br>
test_kdtree.cpp should be plain standard... like it should not require<br>
platform specific headers...<br>
<div class="Ih2E3d"><br>
><br>
><br>
> change in triplet definition:<br>
><br>
> struct triplet {<br>
> typedef int value_type;<br>
><br>
> inline value_type operator[](size_t const N) const { return d[N]; }<br>
> inline bool operator==(triplet const& other) {<br>
> return this->d[0] == other.d[0] && this->d[1] == other.d[1]<br>
> && this->d[2] == other.d[2];<br>
> }<br>
><br>
><br>
> value_type d[3];<br>
> };<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> ===========================<br>
> 2) Nearest neighbor search<br>
> ===========================<br>
><br>
> One thing: As I was really unable to do a pointer comparison of the "duplet"<br>
> struct I chose to compare coordinates.<br>
<br>
</div>Yeah, you won't actually get to do this in the nearest neighbor<br>
search, because, well, it compares by coordinates... I know it my<br>
sound patronizing here, but I don't know how to put it otherwise :)<br>
<div><div></div><div class="Wj3C7c"></div></div></blockquote><div><br>i can add to this, that is why there is a find_exact(), so that you can find *that* node, not just another node that has the same coordinates.<br><br>
<br>i'll stop here since the main thing i wanted to expand on was the VS 2005 stuff.<br></div></div><br>