Skip to content
Snippets Groups Projects
Commit 1ad5bd25 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Do NOT clone the implementation

parent eaaeeb9d
No related branches found
No related tags found
1 merge request!8GraphView cloning proposal + labelGraph proof of concept
Pipeline #32198 passed
......@@ -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(){};
......
......@@ -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:
......
......@@ -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);
}
/////////////////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment