Click here to Skip to main content
15,893,161 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Serialize Pin
Cedric Moonen30-May-07 0:51
Cedric Moonen30-May-07 0:51 
QuestionLooking library for philips 9400 devices Pin
anirudha24329-May-07 23:59
anirudha24329-May-07 23:59 
Questionboot configuration Pin
saisp29-May-07 23:54
saisp29-May-07 23:54 
Questionvector, table and pair, C++ Pin
C_Zealot29-May-07 23:21
C_Zealot29-May-07 23:21 
AnswerRe: vector, table and pair, C++ Pin
Cedric Moonen29-May-07 23:35
Cedric Moonen29-May-07 23:35 
GeneralRe: vector, table and pair, C++ Pin
C_Zealot29-May-07 23:48
C_Zealot29-May-07 23:48 
GeneralRe: vector, table and pair, C++ Pin
Cedric Moonen29-May-07 23:56
Cedric Moonen29-May-07 23:56 
GeneralRe: vector, table and pair, C++ [modified] Pin
Rajkumar R31-May-07 4:05
Rajkumar R31-May-07 4:05 
Hi,
I think your are trying to add multiple occurrence of the word in a vector list in the corresponding word entry.

you may do like this,
 <br />
void WordTable::addWord(string newWord, streampos pos_newWord)<br />
{<br />
   map<string, OccurenceList>::iterator Iter;<br />
   Iter = table.find(newWord)<br />
   if (Iter == table.end())<br />
   { /* insert for the first occurrence */<br />
     OccurenceList list;<br />
     list.push_back(pos_newWord);<br />
     table.insert(make_pair(newWord, list));<br />
   }<br />
   else<br />
   {/* insert for next occurence */<br />
     Iter.second.push_back(pos_newWord);<br />
   }<br />
 .<br />
 .<br />
 .<br />



In your code I think your are also inserting multiple times the same word.


And Also you may make this more simpler if your are using multimap
<br />
<br />
multimap<string, streampos> table;<br />
then you simply needs to do <br />
table.insert(make_pair(newWord, pos_newWord));<br />


Best Regards



-- modified at 0:12 Friday 1st June, 2007
GeneralRe: vector, table and pair, C++ Pin
C_Zealot31-May-07 4:12
C_Zealot31-May-07 4:12 
QuestionLoad combobox Pin
matjame29-May-07 22:41
matjame29-May-07 22:41 
AnswerRe: Load combobox Pin
CPallini29-May-07 22:56
mveCPallini29-May-07 22:56 
AnswerRe: Load combobox Pin
toxcct29-May-07 23:03
toxcct29-May-07 23:03 
JokeRe: Load combobox Pin
super_ttd12-Jun-07 11:14
super_ttd12-Jun-07 11:14 
QuestionChanging dialog box colour Pin
neha.agarwal2729-May-07 22:20
neha.agarwal2729-May-07 22:20 
AnswerRe: Changing dialog box colour Pin
Nibu babu thomas29-May-07 22:25
Nibu babu thomas29-May-07 22:25 
QuestionHow can i add toolbar and menu bar using Shared Addin? Pin
Banks K29-May-07 22:18
Banks K29-May-07 22:18 
AnswerRe: How can i add toolbar and menu bar using Shared Addin? Pin
sw@thi29-May-07 22:46
sw@thi29-May-07 22:46 
QuestionXP style Pin
CodeMak29-May-07 21:56
CodeMak29-May-07 21:56 
AnswerRe: XP style Pin
Nibu babu thomas29-May-07 22:02
Nibu babu thomas29-May-07 22:02 
Question860309 - limiting # of errors Pin
ilostmyid229-May-07 21:49
professionalilostmyid229-May-07 21:49 
AnswerRe: 860309 - limiting # of errors Pin
toxcct29-May-07 22:27
toxcct29-May-07 22:27 
Questionstatic member Pin
nitin329-May-07 21:32
nitin329-May-07 21:32 
AnswerRe: static member Pin
toxcct29-May-07 21:38
toxcct29-May-07 21:38 
AnswerRe: static member Pin
CPallini29-May-07 22:02
mveCPallini29-May-07 22:02 
GeneralRe: static member Pin
toxcct29-May-07 22:26
toxcct29-May-07 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.