Is there a difference between smart pointers and automatic pointers or
they refer to the same idea.
-Thanks 9 2949
* Mohammad: Is there a difference between smart pointers and automatic pointers or they refer to the same idea.
Can you give an example of what you mean by 'automatic pointer'?
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Alf P. Steinbach wrote: * Mohammad:
Is there a difference between smart pointers and automatic pointers or they refer to the same idea.
Can you give an example of what you mean by 'automatic pointer'?
Just a guess here: the standard template class is called auto_ptr,
perhaps that's where the "automatic" comes from...
V
"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:BC**************@newsread1.dllstx09.us.to.ver io.net... Alf P. Steinbach wrote: * Mohammad:
Is there a difference between smart pointers and automatic
pointers orthey refer to the same idea.
Can you give an example of what you mean by 'automatic pointer'?
Just a guess here: the standard template class is called auto_ptr, perhaps that's where the "automatic" comes from...
I'd guess it means a pointer which deletes the managed pointer when it
is destroyed, with no sharing or transfer of ownership allowed -- like
boost::scoped_ptr. Just a guess.
Jonathan
"Jonathan Turkanis" <te******@kangaroologic.com> wrote... "Victor Bazarov" <v.********@comAcast.net> wrote in message news:BC**************@newsread1.dllstx09.us.to.ver io.net... Alf P. Steinbach wrote: * Mohammad:
>Is there a difference between smart pointers and automatic pointers or>they refer to the same idea.
Can you give an example of what you mean by 'automatic pointer'?
Just a guess here: the standard template class is called auto_ptr, perhaps that's where the "automatic" comes from...
I'd guess it means a pointer which deletes the managed pointer when it is destroyed, with no sharing or transfer of ownership allowed -- like boost::scoped_ptr. Just a guess.
Actually, the transfer of ownership does occur in the copy-c-tor, IIRC.
That's how it can be returned from a function.
Victor
"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:hqeQc.245725$Oq2.147653@attbi_s52... "Jonathan Turkanis" <te******@kangaroologic.com> wrote... "Victor Bazarov" <v.********@comAcast.net> wrote in message news:BC**************@newsread1.dllstx09.us.to.ver io.net... Alf P. Steinbach wrote:
> Can you give an example of what you mean by 'automatic
pointer'? Just a guess here: the standard template class is called
auto_ptr, perhaps that's where the "automatic" comes from... I'd guess it means a pointer which deletes the managed pointer
when it is destroyed, with no sharing or transfer of ownership allowed --
like boost::scoped_ptr. Just a guess.
Actually, the transfer of ownership does occur in the copy-c-tor,
IIRC. That's how it can be returned from a function.
Your talking about auto_ptr, right? I was talking about
boost::scoped_ptr, which is non-copyable.
Jonathan
"Jonathan Turkanis" <te******@kangaroologic.com> wrote in message news:<2n************@uni-berlin.de>... "Victor Bazarov" <v.********@comAcast.net> wrote in message news:hqeQc.245725$Oq2.147653@attbi_s52... "Jonathan Turkanis" <te******@kangaroologic.com> wrote... "Victor Bazarov" <v.********@comAcast.net> wrote in message news:BC**************@newsread1.dllstx09.us.to.ver io.net... > Alf P. Steinbach wrote: > Can you give an example of what you mean by 'automatic pointer'? > > Just a guess here: the standard template class is called auto_ptr, > perhaps that's where the "automatic" comes from...
I'd guess it means a pointer which deletes the managed pointer when it is destroyed, with no sharing or transfer of ownership allowed -- like boost::scoped_ptr. Just a guess.
Actually, the transfer of ownership does occur in the copy-c-tor, IIRC. That's how it can be returned from a function.
Your talking about auto_ptr, right? I was talking about boost::scoped_ptr, which is non-copyable.
Jonathan
My impression has been the auto_ptr is the standard library
implementation of the smart pointer concept. com_ptr_t and ComPtr are
more sophisticated ATL implementations. During a conversation with
some one who I think has more experience with C++ than I have, he used
the term 'automatic pointer' which I thought is the same as 'smart
pointer.' So I was just trying to know if I'm correct or not.
Thanks
"Mohammad" <mj*******@hotmail.com> wrote in message
news:3d**************************@posting.google.c om... "Jonathan Turkanis" <te******@kangaroologic.com> wrote in message
news:<2n************@uni-berlin.de>... "Victor Bazarov" <v.********@comAcast.net> wrote in message news:hqeQc.245725$Oq2.147653@attbi_s52... "Jonathan Turkanis" <te******@kangaroologic.com> wrote... > > "Victor Bazarov" <v.********@comAcast.net> wrote in message > news:BC**************@newsread1.dllstx09.us.to.ver io.net... > > Alf P. Steinbach wrote:
> > > Can you give an example of what you mean by 'automatic pointer'? > > > > Just a guess here: the standard template class is called auto_ptr, > > perhaps that's where the "automatic" comes from... > > I'd guess it means a pointer which deletes the managed pointer when it > is destroyed, with no sharing or transfer of ownership allowed -- like > boost::scoped_ptr. Just a guess.
Actually, the transfer of ownership does occur in the copy-c-tor, IIRC. That's how it can be returned from a function.
Your talking about auto_ptr, right? I was talking about boost::scoped_ptr, which is non-copyable.
Jonathan
My impression has been the auto_ptr is the standard library implementation of the smart pointer concept. com_ptr_t and ComPtr are more sophisticated ATL implementations. During a conversation with some one who I think has more experience with C++ than I have, he used the term 'automatic pointer' which I thought is the same as 'smart pointer.' So I was just trying to know if I'm correct or not.
Thanks
Smart pointer means a pointer like class, auto_ptr and com_ptr_t and
boost::shared_ptr are all examples of smart pointers. But different smart
pointers do different things. It is not the case that com_ptr is more
sophisticated than auto_ptr, just that they are different kinds of smart
pointer.
I've never heard the term automatic pointer, so I can't say what your friend
meant by it, perhaps he just made a mistake.
john
"Mohammad" <mj*******@hotmail.com> wrote in message
news:3d**************************@posting.google.c om... Is there a difference between smart pointers and automatic pointers or they refer to the same idea.
I'm not sure what you mean by 'automatic pointer'. A pointer
type with 'auto' storage class would be 'automatic' (in that it
is destroyed automatically when its scope is exited). This has
nothing to do with 'smart pointers'.
If you mean 'std::auto_ptr<>' from the standard library, it is
one of many possible implementations of the general concept 'smart
pointer'.
-Mike
"Mohammad" <mj*******@hotmail.com> wrote in message
news:3d**************************@posting.google.c om... My impression has been the auto_ptr is the standard library implementation of the smart pointer concept.
For the time being, yes, unfortunately.
com_ptr_t and ComPtr are more sophisticated ATL implementations. During a conversation with some one who I think has more experience with C++ than I have, he
used the term 'automatic pointer' which I thought is the same as 'smart pointer.' So I was just trying to know if I'm correct or not.
All my comments were just trying to guess what you might mean.
Jonathan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: christopher diggins |
last post by:
I would like to survey how widespread the usage of smart pointers in C++
code is today. Any anecdotal experience about the frequency of usage of
smart pointer for dynamic allocation in your own...
|
by: Susan Baker |
last post by:
Hi,
I'm just reading about smart pointers..
I have some existing C code that I would like to provide wrapper classes
for. Specifically, I would like to provide wrappers for two stucts
defined...
|
by: Matthias Kaeppler |
last post by:
Hi,
I'm having a hard time figuring out how I can initialize a smart pointer
based on a certain condition:
if something then
ptr = 0; // init with NULL
else
ptr = new XYZ; // init with a...
|
by: Axter |
last post by:
I normally use a program call Doxygen to document my source
code.(http://www.stack.nl/~dimitri/doxygen)
This method works great for small and medium size projects, and you can
get good...
|
by: Jim Langston |
last post by:
Someone made the statement in a newsgroup that most C++ programmers use
smart pointers. His actual phrase was "most of us" but I really don't think
that most C++ programmers use smart pointers,...
|
by: Ney André de Mello Zunino |
last post by:
Hello.
I have written a simple reference-counting smart pointer class template
called RefCountPtr<T>. It works in conjunction with another class,
ReferenceCountable, which is responsible for the...
|
by: Boris |
last post by:
I had a 3 hours meeting today with some fellow programmers that are partly
not convinced about using smart pointers in C++. Their main concern is a
possible performance impact. I've been explaining...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |