Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.83 KB

tutorial_cpp_move_and_swap.rst

File metadata and controls

48 lines (31 loc) · 1.83 KB

Node Move and Swap

The Node class provides move and swap methods that allow you to efficiently combine or exchange data between Node trees. These provide similar semantics to C++ std::move and std::swap.

  • Node::move(Node &n): Allows you to move the entire contents and description of a passed Node into the calling Node. There are no copies. The calling Node assumes management of all pointers and relevant metadata.
  • Node::swap(Node &n): Allows you to swap the entire contents and description of two Nodes. There are no copies. The Node's swap management of all pointers and relevant metadata. The schema parent pointers are updated to reflect the new hierarchy.
  • C++ Move Example:

../../tests/docs/t_conduit_docs_tutorial_move_and_swap.cpp

  • Output:

t_conduit_docs_tutorial_move_and_swap_out.txt

  • C++ Swap Example:

../../tests/docs/t_conduit_docs_tutorial_move_and_swap.cpp

  • Output:

t_conduit_docs_tutorial_move_and_swap_out.txt