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
Inline parameters : What does the compiler do with the parameters of inline function, that can be evaluated in runtime ?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
What is c++ flowchart?
What is dynamic and static typing?
What do you mean by vtable and vptr in c++?
what are the iterator and generic algorithms.
What is low level language in simple words?
Is c++ the hardest programming language?
how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include Is linux written in c or c++? What is the use of namespace std in C++? When is the copy constructor called? What does new do in c++? What are the basic data types used in c++? Can create new c++ operators?