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

Who discovered c++?

576


What is the rule of three?

580


Explain container class.

703


Am studying basic c++ programming, have been given the following assignment. Design a linear program to calculate the maximum stress a material can withstand given a force and a diameter of a circle. To find the required area pi should be defined. Have most of the program sorted out but am at a loss as to how to show the calculations required. Can anyone help?

1752


Why do you use the namespace feature?

662






Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

595


Is rust better than c++?

620


Can you write a function similar to printf()?

679


Explain the advantages of using friend classes.

602


What is flush c++?

545


What is abstraction in c++?

688


What is c++ library?

605


What does it mean to declare a member function as virtual?

593


How many different levels of pointers are there?

664


What are shallow and deep copy?

608