Re: Sorting records using sort()
From: Elijah Bailey (geomrock_at_hotmail.com)
Date: 01/01/04
- Next message: Ron Natalie: "Re: Sorting records using sort()"
- Previous message: Peter Pichler: "Re: endianness and sscanf/sprintf"
- Maybe in reply to: Jeff Schwab: "Re: Sorting records using sort()"
- Next in thread: Ron Natalie: "Re: Sorting records using sort()"
- Reply: Ron Natalie: "Re: Sorting records using sort()"
- Reply: Jeff Schwab: "Re: Sorting records using sort()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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! ]
- Next message: Ron Natalie: "Re: Sorting records using sort()"
- Previous message: Peter Pichler: "Re: endianness and sscanf/sprintf"
- Maybe in reply to: Jeff Schwab: "Re: Sorting records using sort()"
- Next in thread: Ron Natalie: "Re: Sorting records using sort()"
- Reply: Ron Natalie: "Re: Sorting records using sort()"
- Reply: Jeff Schwab: "Re: Sorting records using sort()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|