In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic memory management or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the memory they point to. They may also be used to manage other resources, such as network connections and file handles.
The misuse of pointers is a major source of bugs: the constant allocation, deallocation and referencing that must be performed by a program written using pointers introduces the risk that memory leaks will occur. Smart pointers try to prevent memory leaks by making the resource deallocation automatic: when the pointer (or the last in a series of pointers) to an object is destroyed, for example because it goes out of scope, the referenced object is destroyed too.
Several types of smart pointers exist. Some work with reference counting, others by assigning ownership of the object to a single pointer. If the language supports automatic garbage collection (for instance, Java or C#), then smart pointers are unnecessary for memory management, but may still be useful in managing other resources.
Read more about Smart Pointer: C++ Smart Pointers
Other articles related to "smart pointer, smart, pointer":
... Operations that change the reference count, due to copying or destroying shared_ptr_or_weak_ptr objects, do not provoke data race conditions ... This means that multiple threads can safely store shared_ptr_or_weak_ptr objects that reference the same object ...
... the Mac Integration with Linux GTK theme Bookmark star button Bookmark tags Smart Location Bar Library of bookmarks, history, etc ... Smart Bookmark Folders Web-based protocol handlers for mailto Download Install Add-ons from the Add-on manager Easy to use Download Actions New graphics and font handling in ... such as gradients, background sizing, and pointer events ...
... GTK theme Bookmark star button Bookmark tags Smart Location Bar Library of bookmarks, history, etc ... Smart Bookmark Folders Web-based protocol handlers for mailto Download Install Add-ons from the Add-on manager Easy to use Download Actions New graphics and font handling in Gecko 1.9 provide rendering improvements in ... such as gradients, background sizing, and pointer events ...
Famous quotes containing the words pointer and/or smart:
“The hardiest skeptic who has seen a horse broken, a pointer trained, or has visited a menagerie or the exhibition of the Industrious Fleas, will not deny the validity of education. A boy, says Plato, is the most vicious of all beasts; and in the same spirit the old English poet Gascoigne says, A boy is better unborn than untaught.”
—Ralph Waldo Emerson (18031882)
“The majority of persons choose their wives with as little prudence as they eat. They see a trull with nothing else to recommend her but a pair of thighs and choice hunkers, and so smart to void their seed that they marry her at once. They imagine they can live in marvelous contentment with handsome feet and ambrosial buttocks. Most men are accredited fools shortly after they leave the womb.”
—Edward Dahlberg (19001977)