1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can I have a map with two keys in STL?

Discussion in 'C++' started by victorzk, Sep 4, 2010.

  1. victorzk

    victorzk New Member

    Joined:
    Sep 4, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    If I make an array of strings, a={"apple","banana",etc..}, I can easily find the string corresponding to a given index - ex. a[1].

    If I make a map, mapa, I can easily find the index corresponding to a string - ex. a.find("apple").

    Is there a container that lets me do both? (And the indexes must remain from 0 to N)

    I can probably implement one, but I'm trying to learn STL, so I'm looking for an STL way.

    Thanks!
     

Share This Page