Topic: STL problem with auto_ptr


Author: Nico Josuttis <nico@bredex.de>
Date: 1996/09/30
Raw View
[Moderator's note: this article is crossposted.  Followups are
directed by default to comp.std.c++.]

In article <521q18$q41@engnews1.eng.sun.com>,
Ronny Bremer  <rbremer@future-gate.com> wrote:
>If've found it very difficult to believe, but STL relies on the fact
>that if a class has a copy constructor and assignment operator both are
>taking CONST arguments like this
>
>class foo {
>  foo(const foo& rsh) {};
>  const foo& operator=(const foo& rsh) {};
>}
>
>Of course, it is not true for the auto_ptr class. Hence, the following
>will not compile
>
As far as I know it is NOT true for auto_ptr anymore.
The sepcification of auto_ptr will change.

>vector<auto_ptr<int> > myVector;
>
>myVector.push_back(auto_ptr(new int));
>
>Borland CPP 5.0 mentions in the online help about STL an example like
>the one presented above. And it will not compile....
>
>Any thoughts ?

--
Nico                             address: BREDEX GmbH, Nicolai Josuttis
email:   nico@bredex.de                   Fallersleber-Tor-Wall 23
phone:   +49 531 24330-0                  D-38100 Braunschweig
fax:     +49 531 24330-99                 Germany
---

      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]