liliafan 53 Junior Poster

Does anyone know of a good way to sort an stl map?

I have something like the following example:

#include <iostream>
#include <map>
#include <algorithm>

int main() 
{
   map<int, float> map_to_sort;

   // Populate the map with between 20 - 2000 elements

   map_to_sort.sort(); 
}

Obviously I am aware that map<> doesn't have a sort function :op so does anyone have a quick method of sorting through a map?

From the best I can see I am going to have to manually iterate through all elements of the map and compare and move to a seperate map, I am hoping there is a better solution than this since that seems like a wasteful use of CPU time, this is for a searchengine project I am working on and as can be expected time is critical in this application, especially considering I actually need to sort through 3 seperate maps.

Any help would be really appreciated.

Best regards

Ben

liliafan 53 Junior Poster

Another alternative is to take the source for Mozilla Firebird (open source) make a few customisations to the source (graphics logos) and compile it for internal use. I don't think there would be licensing issues since it is open sourced anyway.

alc6379 commented: GREAT idea! +36
liliafan 53 Junior Poster

Hey "Unregistered"

Well Father, Son and Holy Spirit are all one and the same, they are part of the trinity, therefore, whilst being seperate to us, to God they are all him, so for company it is basically like having multiple personalities lets face it you can't keep yourself company forever.

In regards to someone who can watch everything, that is just it isn't it, watching, how long can you watch without wanting real interaction, in the event that God created everything, then do you not notice that in everything there is partnerships from animals, to fish, to insects, to people, to stars and planets, to galaxies there is interaction everywhere, there is a theme in all of it, nothing in the universe is completely by itself it doesn't work.

How long can you sit at a window and watch the world passing by before you want to get involved, or perhaps how long can you watch a messageboard before you want to say something? Watching isn't the same as interacting, if God doesn't mind being alone then surely his creations wouldn't mind being alone.

Nope as I see it God wants company so he created a spirit as big as himself and divided it amongst all life, so the spirit once it has experienced everything can be a partner to God.

I don't expect everyone to agree with me in fact based on my theory and beliefs no one should agree 100% with me …

Yzk commented: most enlightening... +17
liliafan 53 Junior Poster

C++ is computer language ,for creating windows programs

Note not just windows programs visual c++ is aimed just at windows but C++ itself will work on any platform that a compiler has be written for or ported to.