ch10/327/TextQuery.cpp
//find whitespace-separated words in the input vector
//and puts the word in word_map along with the line number
find whitespace-separated words in the input vector
and puts the word in word_map along with the line number
find whitespace - separated words in the input vector and puts the word in word_map along with the line number
void TextQuery::build_map()
{
	for(line_no line_num = 0; line_num != lines_of_text.size(); ++line_num)
	{
		istringstream line(lines_of_text[line_num]);
		string word;
		while(line >> word)
			word_map[word].insert(line_num);
	}
}
void TextQuery :: build_map ( ) { for ( line_no line_num = 0 ; line_num != lines_of_text . size ( ) ; ++ line_num ) { istringstream line ( lines_of_text [ line_num ] ) ; string word ; while ( line >> word ) word_map [ word ] . insert ( line_num ) ; } }
find whitespace-separated words in the input vector
and puts the word in word_map along with the line number
find whitespace - separated words in the input vector and puts the word in word_map along with the line number
//process each line from the input vector //we'll use line to read the text a word at a time // add this line number to the set; // subscript will add word to the map if it's not already there