Re: Sorting records using sort()

From: Elijah Bailey (geomrock_at_hotmail.com)
Date: 01/01/04


Date: 1 Jan 2004 10:46:26 -0800

Is there no easy way to solve this problem??
I dont want to use qsort from C...! I cant figure
out how to even write a random access iterator
for this problem. What will be its value type?

I would like to swap the records to sort them,
not copy keys and sort them separately...

Thanks in advance for your help,

Thanks ,
--Elijah

geomrock@hotmail.com (Elijah Bailey) wrote in message news:<e008fef8.0312302004.43fed8f0@posting.google.com>...
> I want to sort a set of records using STL's sort() function,
> but dont see an easy way to do it.
>
> I have a
>
> char *data;
>
>
> which has size mn bytes where m is size of the record and
> n is the number of records. Both these numbers are known
> only dynamically. I have a function less_than that can compare
> two records of size m given the pointers to the two records.
>
> Is there an easy way to call STL sort() on this data and sort it.
> The data is big and I do NOT want to allocate a list of pointers
> of size n or anything linear in size. Assume that except the data,
> we do not have much space...
>
> I thought of tricking sort() using a dummy Record class that is
> templated using the size of the record...But since m can change
> dynamically this doesnt work.
>
>
> Thanks in advance for your comments,
> --Elijah
>
> [ See http://www.gotw.ca/resources/clcm.htm for info about ]
> [ comp.lang.c++.moderated. First time posters: Do this! ]



Relevant Pages

  • Re: 75th Rangers ( Gunners unit in Vietnam), was Fast track to inequality....
    ... He isn't within a hundred miles. ... So you wont tell me where the grinder is..yet you threaten to ... I dont remember all of it. ... while we sort her pills into daily dose containers. ...
    (rec.crafts.metalworking)
  • Re: 75th Rangers ( Gunners unit in Vietnam), was Fast track to inequality....
    ... Gunner Asch wrote: ... So you wont tell me where the grinder is..yet you threaten to ... I dont remember all of it. ... while we sort her pills into daily dose containers. ...
    (rec.crafts.metalworking)
  • Re: P.LT. & Amateur Bands in The U.K.
    ... I had two different species of this causing me ... Well if I called them effing cretins, as you called me, I dont really ... create imaginary problems, than logically, sort it out themselves. ... I think that it's you that's flummoxed and it's high time that you ...
    (uk.radio.amateur)
  • Re: P.LT. & Amateur Bands in The U.K.
    ... I had two different species of this causing me ...   They both disappeared all of a sudden over the last ... Well if I called them effing cretins, as you called me, I dont really ... create imaginary problems, than logically, sort it out themselves. ...
    (uk.radio.amateur)
  • Re: McCartney punched and spat at his producer
    ... to be honest i'd prefer paul go deeper into the arty sort of somber biz ... the mature sounding biz. ... i just dont think it's suited for him as ... biz over driving rains sort of silly pop rock. ...
    (rec.music.beatles)