Troubles with multimap

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Emilio
Experienced poster
Posts: 163
Joined: Sun Oct 17, 2004 8:31 pm
Location: Murcia, Spain

Troubles with multimap

Post by Emilio » Sat Apr 16, 2005 8:12 pm

Hello,
I have a small problem, I have the next code:

Code: Select all

struct comp
{
     bool operator () (const char *a, const char *b)
     {
         return strcmp(a,b) < 0;
     }
};

typedef set<int> conjs;
multimap<char*, conjs, comp> palabras;
and now, if I want insert an element in palabras, how can I do it?
For example I want insert

Code: Select all

char *pal;
in palabras, Can anyone say me how do it?
If is possible write an example for this example, please.
I have tried in this manner

Code: Select all

palabras.insert(palabras.begin(), pal);
is correct this? or is my compiler?

Thanks!

User avatar
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba » Sat Apr 16, 2005 9:11 pm


Emilio
Experienced poster
Posts: 163
Joined: Sun Oct 17, 2004 8:31 pm
Location: Murcia, Spain

Post by Emilio » Sun Apr 17, 2005 1:36 am

Thanks!
I would must have searched more carefully.

Post Reply

Return to “C++”