Oslandia / SFCGAL

MOVED TO GITLAB: https://gitlab.com/sfcgal/SFCGAL. A wrapper around CGAL that intents to implement 2D and 3D operations on OGC standards models
https://sfcgal.org
Other
112 stars 54 forks source link

"Geometry& operator= " is not implemented #195

Closed happydpc closed 4 years ago

happydpc commented 5 years ago

The operator = in Geometry has not been implemented. It causes the compile error:

triangulatePolygon.obj : error LNK2001: "protected: class SFCGAL::Geometry const & cdecl SFCGAL::Geometry::operator=(class SFCGAL::Geometry const &)" (??4Geometry@SFCGAL@@IEAAAEBV01@AEBV01@@Z) 1>ForceZOrderPoints.obj : error LNK2001: "protected: class SFCGAL::Geometry const & cdecl SFCGAL::Geometry::operator=(class SFCGAL::Geometry const &)" (??4Geometry@SFCGAL@@IEAAAEBV01@AEBV01@@Z) 1>ConstraintDelaunayTriangulation.obj : error LNK2001: "protected: class SFCGAL::Geometry const & cdecl SFCGAL::Geometry::operator=(class SFCGAL::Geometry const &)" (??4Geometry@SFCGAL@@IEAAAEBV01@AEBV01@@Z) 1>triangulateInGeometrySet.obj : error LNK2001: "protected: class SFCGAL::Geometry const & cdecl SFCGAL::Geometry::operator=(class SFCGAL::Geometry const &)" (??4Geometry@SFCGAL@@IEAAAEBV01@AEBV01@@Z) 1>triangulate2DZ.obj : error LNK2001: "protected: class SFCGAL::Geometry const & __cdecl SFCGAL::Geometry::operator=(class SFCGAL::Geometry const &)" (??4Geometry@SFCGAL@@IEAAAEBV01@AEBV01@@Z)

mhugo commented 5 years ago

@happydpc It is declared as protected. Which compiler / version are you using ?

happydpc commented 5 years ago

VS2017, I added a default implementation, with just assigning the validFlag_. Now it works.

mhugo commented 5 years ago

@happydpc Ok. Could you send a pull request ?

happydpc commented 5 years ago

Ok, I will do that.

mhugo commented 5 years ago

Why does it not complain about the missing copy constructor then ? I don't understand

danielcu888 commented 4 years ago

@mhugo the reason is is because clearly @happydpc is assigning to an already existing SFCGAL::Geometry (subclass) object, rather than creating a new one. Hence, in the former the copy-constructor will not be used, whereas in the latter it would be and the statement would not compile.

It would however be preferable for both the copy constructor and assignment operators to be public if one is made public so that the convenience of initialisation and assignment can be conducted in a single statement.

danielcu888 commented 4 years ago

@mhugo can this issue now be closed as done?

danielcu888 commented 4 years ago

thanks @mhugo !