multimap stl

Discussion in 'C++' started by Anon, Dec 21, 2006.

  1. Anon

    Anon Guest

    i must create a muiltimap with 2 string , 1 int and 1 iterator to
    multimap itself

    how could define the typedef?


    thank
    Anon, Dec 21, 2006
    #1
    1. Advertising

  2. wrote:
    > i must create a muiltimap with 2 string , 1 int and 1 iterator to
    > multimap itself
    >
    > how could define the typedef?


    Ask yourself, "what is the key?" and "what is the data?".
    Gianni Mariani, Dec 21, 2006
    #2
    1. Advertising

  3. Anon

    Anon Guest

    one string is a key other are the date

    Gianni Mariani wrote:
    > wrote:
    > > i must create a muiltimap with 2 string , 1 int and 1 iterator to
    > > multimap itself
    > >
    > > how could define the typedef?

    >
    > Ask yourself, "what is the key?" and "what is the data?".
    Anon, Dec 21, 2006
    #3
  4. Anon

    Mark P Guest

    wrote:
    > one string is a key other are the date
    >


    Don't top post. Replies go after whatever you're responding to.

    > Gianni Mariani wrote:
    >> wrote:
    >>> i must create a muiltimap with 2 string , 1 int and 1 iterator to
    >>> multimap itself
    >>>
    >>> how could define the typedef?

    >> Ask yourself, "what is the key?" and "what is the data?".

    >


    A map (or multimap) key and data must be *types*. The key can be a
    string, but the data cannot be "a string, an int, and an iterator"
    because that is three types, not a single type. Probably the
    appropriate thing to do is define a class or structure to hold those
    three quantities and make that class or structure the data type.

    struct BunchOfTypes
    {
    string s;
    int i;
    multimap<string,BunchOfTypes>::iterator iter;
    };
    Mark P, Dec 21, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Mills
    Replies:
    7
    Views:
    4,502
    John Harrison
    Jun 23, 2004
  2. Replies:
    4
    Views:
    505
  3. Tommo
    Replies:
    2
    Views:
    549
    Tom Widmer
    May 22, 2006
  4. reppisch
    Replies:
    6
    Views:
    967
    reppisch
    Jun 19, 2007
  5. STL multimap

    , May 5, 2008, in forum: Python
    Replies:
    6
    Views:
    886
Loading...

Share This Page