During a random documentation check on cppreference.com
i noticed new member function overloads for some containers taking as a parameter what happens to be a new standard type from C++17
called a Node Handle
.
Now the documentation page of node handles on the same site gives multiple details and technical behaviors on how this work, but it doesn't really convey properly the general idea and purpose of this new type.
Hence the question, what is a Node Handle ?
The idea of a node handle is that refers to a 'node' of the map or set which is disembodied from the map itself. Its purpose is to be able to move items from one map to another without invoking any overhead for copying or moving keys or data. An example here: http://en.cppreference.com/w/cpp/container/map/extract.
Initializing the node through a call to one of the ros::init() functions. This provides command line arguments to ROS, and allows you to name your node and specify other options. Starting the node is most often done through creation of a ros::NodeHandle, but in advanced cases can be done in different ways.
Graph Resource Names are an important mechanism in ROS for providing encapsulation. Each resource is defined within a namespace, which it may share with many other resources. In general, resources can create resources within their namespace and they can access resources within or above their own namespace.
Node based containers have the potential to support easy extraction and merger. It would be as simple as unlinking the internal nodes from set A, and placing them into set B. This is different to moving Keys and Values out of the container, in that we aren't left with "empty" nodes that need cleanup, nor are we allocating a new node when we already have a perfectly good one that can just be moved itself.
To facilitate this new API for the containers the standard needed a way to let client programmers get a hold of those nodes, without breaking encapsulation. Hence the handle.
The idea of a node handle is that refers to a 'node' of the map or set which is disembodied from the map itself.
Its purpose is to be able to move items from one map to another without invoking any overhead for copying or moving keys or data.
An example here:
http://en.cppreference.com/w/cpp/container/map/extract
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With