mercredi 31 mai 2023

node-handle vs std::unique_ptr

Reading the documentation of the node-handle interface and studying some implementations of the standard library, I noticed that many features of the node-handle type can simply be emulated by a specialization of the std::unique_ptr smart pointer. In fact, the functionalities of the node-handle type are very similar to the functionalities of a std::unique_ptr smart pointer. It has only an interface more compliant with the features of an associative container, such as the key_type and mapped_type aliases and the functions to get a reference of the underlying value or key/mapped value.

So, are there any other advantages therefore the standard had introduced a node-handle type over a simple specialization of std::unique_ptr as node_type?

Aucun commentaire:

Enregistrer un commentaire