sorting a std::list
velthuijsen_at_hotmail.com
Date: 12/31/04
- Next message: Mike Hewson: "Re: a problem with poliporphism [OT]"
- Previous message: Mike Hewson: "Re: Rate yourself as a C++ programmer, 1 to 10"
- Next in thread: Mike Hewson: "Re: sorting a std::list"
- Reply: Mike Hewson: "Re: sorting a std::list"
- Reply: Ioannis Vranos: "Re: sorting a std::list"
- Reply: Jon Wilson: "Re: sorting a std::list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Dec 2004 01:15:47 -0800
I tried taking a list and pass it through std::sort like the following:
sort(Unsorted.begin(), Unsorted.end());
I got an error back stating that the list iterator doesn't have a
binary substraction operator.
Peeking in the algoritm header file it's clear why seeing that sort
there calls _sort(_First, _Last, _Last-_First) which might be a tad
challenging seeing that the different values stored in a list do not
need to be stored consecutively.
My question is there another way to sort the list in the STL?
- Next message: Mike Hewson: "Re: a problem with poliporphism [OT]"
- Previous message: Mike Hewson: "Re: Rate yourself as a C++ programmer, 1 to 10"
- Next in thread: Mike Hewson: "Re: sorting a std::list"
- Reply: Mike Hewson: "Re: sorting a std::list"
- Reply: Ioannis Vranos: "Re: sorting a std::list"
- Reply: Jon Wilson: "Re: sorting a std::list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|