Skip to content

Broken ocl::Path(const Path &) constructor #159

@petterreinholdtsen

Description

@petterreinholdtsen

The copy constructor for ocl::Path is a no-op, not copying anything from the source object. Why is it there? As far as I can tell, the code build just fine without the copy constructor. If it is needed and wanted, what about making it a proper copy constructor which make a copy of the content of the source object.

Here is a draft patch removing the copy constructor, and including a simple implementation of the list copying.


--- opencamlib-salsa.orig/src/geo/path.cpp	2023-09-11 12:07:29.133078761 +0200
+++ opencamlib-salsa/src/geo/path.cpp	2023-09-11 12:07:29.125078733 +0200
@@ -28,9 +28,12 @@
 Path::Path() {
 }
 
+  /*
 Path::Path(const Path &p) {
+  std::copy(p.span_list.begin(), p.span_list.end(),
+	    std::back_inserter(span_list));
 }
-
+  */
 Path::~Path() {
 }
 
--- opencamlib-salsa.orig/src/geo/path.hpp	2023-09-11 12:07:29.133078761 +0200
+++ opencamlib-salsa/src/geo/path.hpp	2023-09-11 12:07:29.125078733 +0200
@@ -98,7 +98,7 @@
         /// create empty path
         Path();
         /// copy constructor
-        Path(const Path &p);
+        //Path(const Path &p);
         /// destructor
         virtual ~Path();
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions