Alright, here's the code:

for ( map<string,int>::iterator word = mostUsed.begin() ;
		word != mostUsed.end() ; word++ )

and the error by g++ - (using make)

error: conversion from 'std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >; int> >' to non-scalar type 'std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >; int> >' requested

Okay... what in the name of the gods? I used this code before in the program and nothing screwed up. here's that for-loop:

for( map<string,int>::iterator x = fauxIn.begin() ; x != fauxIn.end() ; x++ )

I don't see the problem, apparently map<string,int>::iterator word = mostUsed.begin() is the problem, but I don't see anything wrong.

Help!

mostUsed is a const. use a const_iterator. also a prefix increment instead of a postfix (efficiency)

for ( map<string,int>::const_iterator word = mostUsed.begin() ;
		word != mostUsed.end() ; ++word ) { /*...*/
commented: Impressive advise, Glad I got your help. +2

Wow, thanks! That allowed me to compile for the first time in a month. ^_^ I wouldn't have thought to make it a const_iterator instead of a regular iterator.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.