I'm looking for an equivalent to the 'map' function in C++,
http://www.cplusplus.com/reference/map/map/.
Essentially, I want an associative array. Specifically, I want the array to
be indexed by floats.
I'm aware of dictionaries in Python, but my program seems to take a lot of
time because the dictionary is not sorted by its key value... it's
unordered. I need to find the "first" (smallest key) element. Currently, I
do this using myDictionary[min(myDictionary.keys())].
For example,
myDictionary={1.1:1, 1.5:2, 0.9:3}
myDictionary[min(myDictionary.keys())]
will print out 3.
But calling the "min" function takes time for large arrays, and I figured
if the array was constructed in an ordered manner, it would be more
efficient (even though insert elements would take more time as well), which
is why I'm looking for the equivalent to the map command in C++.
Thanks
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.