Re: libstdc++/3551: error in auto_ptr implementation
Matthias Klose wrote:
>
> The code below does not compile with g++ 3.0, but it seems correct
> judging by my C++ books.
>
> Wichert.
>
> #include <memory>
> #include <list>
> using namespace std;
> int main(int, char**) {
> auto_ptr<int> api(new int(5));
> list<auto_ptr<int> > lapi;
> lapi.push_back(api);
> return 0;
> }
This is not supposed to work. STL containers of auto_ptr are illegal
(23.1 para 3, container elements must be CopyConstructible and
Assignable; auto_ptr is neither).
--
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army." -- Neal Stephenson
Reply to: