<div dir="ltr"><div><div><div><div>Hi all,<br></div>In my program I need to use map<structure, int> in the following way, but it shows me a conflict between vtkoperator and my structure operator.<br><br>struct bin3Dh{<br>
int fbin;<br> int gbin;<br> int sbin;<br>};<br>inline bool operator>(bin3Dh left, bin3Dh right) {<br> if (left.fbin > right.fbin){<br> return true;<br> }<br> else if (left.fbin < right.fbin) {<br>
return false;<br> }<br> else if (left.gbin > right.gbin) {<br> return true;<br> }<br> else if (left.gbin < right.gbin) {<br> return false;<br> }<br> else if (left.sbin > right.sbin) {<br>
return true;<br> }<br> else if (left.sbin < right.sbin) {<br> return false;<br> }<br> else{<br> return false;<br> }<br>}<br>map<bin3Dh, int> mapHistogram3D;<br>map<bin3Dh, int>::iterator it;<br>
<br>void create3dh(double f,double g, double s){<br> bin3Dh tmphisto;<br> tmphisto.fbin=int((f/frange)*256.0);<br> tmphisto.gbin=int((g/grange)*256.0);<br> tmphisto.sbin=int((s/srange)*256.0);<br> if(mapHistogram3D.count(tmphisto)>0){<br>
it=mapHistogram3D.find(tmphisto);<br> it->second++;<br> }<br> else{<br> mapHistogram3D.insert(pair<bin3Dh,int>(tmphisto,1));<br> }<br>}<br><br></div>Do you have any idea about this problem and how can I define operator for my structure to use in map?<br>
<br>Error list:<br> no known conversion for argument 1 from ‘const bin3Dh’ to ‘const vtkWeakPointerBase&’<br> operator op (const vtkWeakPointerBase& l, const vtkWeakPointerBase& r) \<br> ^<br>note: vtkstd_bool operator<(const vtkWeakPointerBase&, vtkObjectBase*)<br>
operator op (const vtkWeakPointerBase& l, vtkObjectBase* r) \<br> ^<br>/usr/include/vtk-5.8/vtkWeakPointerBase.h:102:1: note: in expansion of macro ‘VTK_WEAK_POINTER_BASE_DEFINE_OPERATOR’<br> VTK_WEAK_POINTER_BASE_DEFINE_OPERATOR(<)<br>
<br></div>Best Regards,<br></div>Mohammad<br><div><div><br><br><br><br><br><br><br></div></div></div>