++





, . , , - begin() end(). display_map_text():

void

display_map_text( map<string,loc*> *text_map )

{

typedef map<string,loc*> tmap;

tmap::iterator iter = text_map->begin(),

iter_end = text_map->end();

while ( iter != iter_end )

{

cout << "word: " << (*iter).first << " (";

int loc_cnt = 0;

loc *text_locs = (*iter).second;

loc::iterator liter = text_locs->begin(),

liter_end = text_locs->end();

while (liter != liter_end ) {

if ( loc_cnt )

cout << ',';

else ++loc_cnt;

cout << '(' << (*liter).first

<< ',' << (*liter).second << ')';

++liter;

}

cout << ")\n";

++iter;

}

cout << endl;

}

, . , , - size():

if ( text_map->size() )

display_map_text( text_map );

, , - empty():

if ( ! text_map->empty() )

display_map_text( text_map );