cannot use obsolete binding at ‘input’ because it has a destructor
Posted
by
ihm
on Stack Overflow
See other posts from Stack Overflow
or by ihm
Published on 2011-11-12T17:44:25Z
Indexed on
2011/11/12
17:50 UTC
Read the original article
Hit count: 433
c++
here's the word-count I wrote. I got this error: cannot use obsolete binding at ‘input’ because it has a destructor
and error: name lookup of ‘input’ changed for ISO ‘for’ scoping
what are they suppose to mean? thanks in advance.
//rewrite the word-count program using insert instead of subscripting
#include <iostream>
#include <utility>
#include <map>
#include <string>
using namespace std;
int main ()
{
cout<<"please enter some words"<<endl;
map<string,int> word_count;
for(string input; cin>>input; )
if(!word_count.insert(make_pair(input,1)).second);
++word_count[input];
for(map<string,int>::iterator iter=word_count.begin(); iter!=word_count.end(); ++iter)
cout<<iter->first<<": "<<iter->second<<endl;
return 0;
}
© Stack Overflow or respective owner