Topic: copying a priority_queue


Author: Marc <marc.glisse@gmail.com>
Date: Fri, 16 Jul 2010 16:19:30 CST
Raw View
Hello,

it looks like, in the latest draft for C++0X, container adaptors like
priority_queue are not copyable (neither by a copy constructor nor
operator=), only movable. This breaks some code, and I can't think of
a good reason to forbid such copies. Could you point me to the
corresponding discussion? Or is it related to the change of meaning of
rvalue references and the library hasn't been updated yet?

(From a stylistic point of view, it is confusing in the description of
vector that "vector" and "vector<T,Allocator>" are randomly/
inconsistently used.)

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@googlemail.com>
Date: Sat, 17 Jul 2010 07:00:46 CST
Raw View
On 17 Jul., 00:19, Marc <marc.gli...@gmail.com> wrote:
> Hello,
>
> it looks like, in the latest draft for C++0X, container adaptors like
> priority_queue are not copyable (neither by a copy constructor nor
> operator=), only movable. This breaks some code, and I can't think of
> a good reason to forbid such copies. Could you point me to the
> corresponding discussion? Or is it related to the change of meaning of
> rvalue references and the library hasn't been updated yet?

This is not intentional. The final acceptance of the current rules
for implicit special members with addition of move constructors
and move assignment operators has lead to this problem within
the library. This silent change in meaning should definitively
be cleaned up. The committee was aware of this gap between
core language and library, but from a practical point of view it
would not have been possible to introduce both the core language
rules and a full library fix in a single sweep without risking a
further
delay of the FCD.

> (From a stylistic point of view, it is confusing in the description of
> vector that "vector" and "vector<T,Allocator>" are randomly/
> inconsistently used.)

Yes, but this is a purely editorial issue.

HTH & Greetings from Bremen,

Daniel Kr   gler


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]