public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: "René Bürgel" <rbuergel@web.de>
Cc: gcc-help@gcc.gnu.org
Subject: Re: [C++0x unique_ptr] sorting a vector of unique_ptr fails
Date: Mon, 15 Dec 2008 19:30:00 -0000	[thread overview]
Message-ID: <m3bpvdfdal.fsf@google.com> (raw)
In-Reply-To: <49440067.3020504@web.de> (=?utf-8?Q?=22Ren=C3=A9_B=C3=BCrgel?=  =?utf-8?Q?=22's?= message of "Sat\, 13 Dec 2008 19\:35\:19 +0100")

René Bürgel <rbuergel@web.de> writes:

> Is the following code supposed to work in C++0x-Mode or am i just
> doing something wrong?
>
> #include <memory>
> #include <vector>
> #include <algorithm>
>
> int main()
> {
>        std::vector<std::unique_ptr<int> > v;
>        std::sort(v.begin(), v.end());
> }

I think it is supposed to work.  The standard says that the value
must be Swappable, MoveConstructible, and MoveAssignable.  I think
that std::unique_ptr meets those requirements.

I think this is a bug in libstdc++-v3.  Looking at the code, I think
this means that __introsort_loop can't assume that it can pass values
to std::__median.

Ian

  reply	other threads:[~2008-12-15 19:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13 17:35 René Bürgel
2008-12-15 19:30 ` Ian Lance Taylor [this message]
2008-12-15 20:22   ` Christopher Jefferson
2008-12-15 23:46     ` René Bürgel
2008-12-16  6:14       ` Ian Lance Taylor
2008-12-17  0:44         ` René Bürgel
2008-12-17  0:50           ` Diego Novillo
2008-12-17  1:06             ` Diego Novillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3bpvdfdal.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=rbuergel@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).