Doubt in STL-MAP!!!!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Doubt in STL-MAP!!!!

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Bangalore
    Posts
    78

    Question Doubt in STL-MAP!!!!

    Hi All,

    After all the datas are insert to the MAP, is it is possible to re-sort the MAP using some other key ??

    With Best Regards,
    A.Ilamparithi

  2. #2
    Join Date
    Apr 1999
    Posts
    27,444
    You must erase the key and use a different key. A map automatically sorts when you insert elements.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Doubt in STL-MAP!!!!

    Originally posted by ilamparithi
    Hi All,

    After all the datas are insert to the MAP, is it is possible to re-sort the MAP using some other key ??
    No, that's not possible. An std::map is always sorted by the key type that is given to it at compile-time. The only way you can sort by something else is to copy the contents to a new map or vector which is then sorted on a different key.

    You must erase the key and use a different key.
    I'm not sure what you mean here.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  4. #4
    Join Date
    Apr 1999
    Posts
    27,444

    Re: Re: Doubt in STL-MAP!!!!

    Originally posted by Yves M
    I'm not sure what you mean here.
    Assuming that the OP wants to have the data show up somewhere else in the map, he has to delete the old key and reinsert the data with a new key.

    Regards,

    Paul McKenzie

  5. #5
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Re: Re: Doubt in STL-MAP!!!!

    Originally posted by Paul McKenzie
    Assuming that the OP wants to have the data show up somewhere else in the map, he has to delete the old key and reinsert the data with a new key.
    Ah, I get it. I didn't the read the question that way
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center