This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++0x unique_ptr] sorting a vector of unique_ptr fails



Christopher Jefferson schrieb:

On 15 Dec 2008, at 19:28, Ian Lance Taylor wrote:


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.


It is a "bug" in that not all of libstdc++-v3 has been updated to C++0x. Sort is one such example.

Chris
Would it be useful to file a bugreport (at least for keeping track of this) or can this fact be assumed to be commonly known by the responsible persons, meaning that it is on their todo-list anyway? Maybe i can take a closer look at this during the xmas holiday and create a patch to fix this issue. Would this need any paperworks with the FSF?

René


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]