diff --git a/include/aidge/backend/OperatorImpl.hpp b/include/aidge/backend/OperatorImpl.hpp index cc77ab05364db74b8547b2789efdca19702413d3..453e30a8636d86794c96723350bff615af090e3e 100644 --- a/include/aidge/backend/OperatorImpl.hpp +++ b/include/aidge/backend/OperatorImpl.hpp @@ -20,10 +20,6 @@ namespace Aidge { class OperatorImpl { public: - /** - * @brief Clone the implementation using its copy-constructor. - */ - virtual std::unique_ptr<OperatorImpl> clone() const = 0; virtual void forward(){}; virtual void backward(){}; diff --git a/include/aidge/operator/Operator.hpp b/include/aidge/operator/Operator.hpp index 892e5bdb7d9cf86cc7c7c82f5c7d2361defb70a8..f99b1e26d38f92b8654de4a49222817fc950ff2c 100644 --- a/include/aidge/operator/Operator.hpp +++ b/include/aidge/operator/Operator.hpp @@ -42,7 +42,9 @@ public: std::enable_shared_from_this<Operator>() { mType = op.mType; - mImpl = op.mImpl->clone(); + // Implementation is never cloned. It is up to the non-abstract Operator copy-constructor to create a new implementation matching the copied Operator implementation. + // See https://gitlab.eclipse.org/eclipse/aidge/aidge_core/-/merge_requests/8#note_1214050 for the discussion. + // Hooks are not copied. } public: diff --git a/src/graph/Node.cpp b/src/graph/Node.cpp index 0155b22d7b1a429ef48eca043550f78d17660029..54fdac808642f3ae603e237737e265ba394fccbd 100644 --- a/src/graph/Node.cpp +++ b/src/graph/Node.cpp @@ -332,13 +332,13 @@ Aidge::NodePtr Aidge::Node::cloneSharedOperators() const { Aidge::NodePtr Aidge::Node::cloneSharedProducers() const { std::shared_ptr<Operator> op = (mOperator->type() == Producer_Op::Type) ? mOperator - : std::shared_ptr<Operator>(mOperator->clone()); + : mOperator->clone(); return std::make_shared<Node>(op, mName); } Aidge::NodePtr Aidge::Node::clone() const { - return std::make_shared<Node>(std::shared_ptr<Operator>(mOperator->clone()), mName); + return std::make_shared<Node>(mOperator->clone(), mName); } /////////////////////////////////////////////////////////////////////////////////////////////