diff --git a/examples/DataflowExamples/FunctionalsGraph/main.cpp b/examples/DataflowExamples/FunctionalsGraph/main.cpp index f4758de48ca..136cd27ed9c 100644 --- a/examples/DataflowExamples/FunctionalsGraph/main.cpp +++ b/examples/DataflowExamples/FunctionalsGraph/main.cpp @@ -37,12 +37,12 @@ int main( int argc, char* argv[] ) { //! [Creating Nodes] //! [Adding Nodes to the graph] - g.addNode( sourceNode ); - g.addNode( mapSource ); - g.addNode( transformNode ); - g.addNode( reduceNode ); - g.addNode( sinkNode ); - g.addNode( scalarSinkNode ); + g.addNode( std::unique_ptr( sourceNode ) ); + g.addNode( std::unique_ptr( mapSource ) ); + g.addNode( std::unique_ptr( transformNode ) ); + g.addNode( std::unique_ptr( reduceNode ) ); + g.addNode( std::unique_ptr( sinkNode ) ); + g.addNode( std::unique_ptr( scalarSinkNode ) ); //! [Adding Nodes to the graph] //! [Creating links between Nodes] diff --git a/examples/DataflowExamples/GraphSerialization/main.cpp b/examples/DataflowExamples/GraphSerialization/main.cpp index 950cf251f85..09b19982ed4 100644 --- a/examples/DataflowExamples/GraphSerialization/main.cpp +++ b/examples/DataflowExamples/GraphSerialization/main.cpp @@ -51,9 +51,9 @@ int main( int argc, char* argv[] ) { //! [Creating Nodes] //! [Adding Nodes to the graph] - g.addNode( sourceNode ); - g.addNode( filterNode ); - g.addNode( sinkNode ); + g.addNode( std::unique_ptr( sourceNode ) ); + g.addNode( std::unique_ptr( filterNode ) ); + g.addNode( std::unique_ptr( sinkNode ) ); //! [Adding Nodes to the graph] //! [Creating links between Nodes] diff --git a/examples/DataflowExamples/HelloGraph/main.cpp b/examples/DataflowExamples/HelloGraph/main.cpp index 834d554ff66..fdceb6aa4f4 100644 --- a/examples/DataflowExamples/HelloGraph/main.cpp +++ b/examples/DataflowExamples/HelloGraph/main.cpp @@ -16,17 +16,22 @@ int main( int argc, char* argv[] ) { //! [Creating an empty graph] //! [Creating Nodes] - auto sourceNode = new Sources::SingleDataSourceNode( "Source" ); - auto predicateNode = new Sources::ScalarUnaryPredicateSource( "Selector" ); - auto filterNode = new Functionals::FilterNode( "Filter" ); - auto sinkNode = new Sinks::SinkNode( "Sink" ); + auto addedSourceNode = std::make_unique>( "Source" ); + auto addedPredicateNode = std::make_unique( "Selector" ); + auto addedFilterNode = std::make_unique>( "Filter" ); + auto addedSinkNode = std::make_unique>( "Sink" ); + // get non-owning aliases to ease future node management + auto sourceNode = addedSourceNode.get(); + auto predicateNode = addedPredicateNode.get(); + auto filterNode = addedFilterNode.get(); + auto sinkNode = addedSinkNode.get(); //! [Creating Nodes] //! [Adding Nodes to the graph] - g.addNode( sourceNode ); - g.addNode( predicateNode ); - g.addNode( filterNode ); - g.addNode( sinkNode ); + g.addNode( std::move( addedSourceNode ) ); + g.addNode( std::move( addedPredicateNode ) ); + g.addNode( std::move( addedFilterNode ) ); + g.addNode( std::move( addedSinkNode ) ); //! [Adding Nodes to the graph] //! [Creating links between Nodes]