Discussion:
E2316 auto_ptr is not a member of std
(too old to reply)
Dan Quinn
2008-05-27 20:23:36 UTC
Permalink
Where did std::auto_ptr go?
Duane Hebert
2008-05-27 20:30:48 UTC
Permalink
Post by Dan Quinn
Where did std::auto_ptr go?
Is it not still in <memory>?
Vladimir Grigoriev
2008-05-28 11:01:59 UTC
Permalink
Post by Dan Quinn
Where did std::auto_ptr go?
As it was already said auto_ptr conceals itself in <memory>. However every
std container knows where auto_ptr conceals itself. So if you have, for
example,

#include <vector>

when you do not need to include <memory> though you may include it
explicitly to underline that you use auto_ptr youself..

Vladimir Grigoriev
Chris Uzdavinis (TeamB)
2008-05-30 13:55:41 UTC
Permalink
Post by Vladimir Grigoriev
Post by Dan Quinn
Where did std::auto_ptr go?
As it was already said auto_ptr conceals itself in <memory>. However every
std container knows where auto_ptr conceals itself. So if you have, for
example,
#include <vector>
when you do not need to include <memory> though you may include it
explicitly to underline that you use auto_ptr youself..
I'd suggest that if you need auto_ptr, for example, that you *always*
include the header that is defined to provide it, regardless if it
just-so-happens to be pulled in elsewhere.

It's *never* a good idea to needlessly add dependencies on
implementation deails.
--
Chris (TeamB);
Vladimir Grigoriev
2008-05-30 15:51:24 UTC
Permalink
I agree.
Post by Chris Uzdavinis (TeamB)
Post by Vladimir Grigoriev
Post by Dan Quinn
Where did std::auto_ptr go?
As it was already said auto_ptr conceals itself in <memory>. However every
std container knows where auto_ptr conceals itself. So if you have, for
example,
#include <vector>
when you do not need to include <memory> though you may include it
explicitly to underline that you use auto_ptr youself..
I'd suggest that if you need auto_ptr, for example, that you *always*
include the header that is defined to provide it, regardless if it
just-so-happens to be pulled in elsewhere.
It's *never* a good idea to needlessly add dependencies on
implementation deails.
--
Chris (TeamB);
Loading...