David Stroupe writes:
> Paul Grenyer writes:
>
>> *** Before acting on this e-mail or opening any attachment you are
>> advised to read the disclaimer at the end of this e-mail ***
>>
>> Hi
>>
>>> I have a group of data that is made up of pairs of strings. I want to
>>> read these pairs from a file, sort them into alphabetical order and then
>>> write them to a new file. std::map seemed to be the perfect choice, but
>>> when I create a std::map<std::string, std::string> variable I get a
>>> bazillion C4786 warnings regarding identifiers being truncated to 255
>>> characters in either debugging info or browser info. Granted the code
>>> compiles, but all the warnings must indicate something that I should be
>>> doing differently. Is there a better STL choice for what I am trying to
>>> accomplish?
>>
>> These warnings don't mean there is anything wrong with your code. They
>> just
>> show the inadequacy of the compiler.
>>
>> A map is a good choice. You might also like to consider a sorted vector.
>> Regards
>> Paul
> Thanks Paul,
> The only concern I have with the vector approach is that I need to do
> extra work to associate the two components. Using the map gets me there
> with only a few lines of code. Regarding sorting the map....I was under
> the impression that the first element of any given pair was the key and
> that the keys were sorted as I inserted them, but when I iterate through
> the map, my keys are still in the inserted order and not sorted order.
> Did I miss something?
>
But I did get a nicely sorted list of char*'s ;-) <blush>
If I truly insert strings they are sorted correctly.
Thanks again Paul,
David
