what is smart pointer & use of the smart pointer ???

Answer Posted / swarna sekhar dhar

Smart pointers have been the subject of hecatombs of code
written and rivers of ink consumed by programmers and
writers around the world. Perhaps the most popular,
intricate, and powerful C++ idiom, smart pointers are
interesting in that they combine many syntactic and semantic
issues. This chapter discusses smart pointers, from their
simplest aspects to their most complex ones and from the
most obvious errors in implementing them to the subtlest
ones—some of which also happen to be the most gruesome.

In brief, smart pointers are C++ objects that simulate
simple pointers by implementing operator-> and the unary
operator*. In addition to sporting pointer syntax and
semantics, smart pointers often perform useful tasks—such as
memory management or locking—under the covers, thus freeing
the application from carefully managing the lifetime of
pointed-to objects

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain object slicing in c++?

687


Do inline functions improve performance?

737


What are the extraction and insertion operators in c++?

663


Is c++ vector dynamic?

646


What size is allocated to the union variable?

683






Write a program to interchange 2 variables without using the third one.

675


Explain register storage specifier.

692


Differentiate between structure and class in c++.

706


Why should you learn c++?

674


How is computer programming useful in real life?

672


What is object in c++ example?

709


Does a derived class inherit or doesn't inherit?

717


Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort

750


Describe friend function & its advantages.

804


What is an iterator?

776