I've written a program that uses the STL, and recently came across the
concept of automatic type determination. Which I think is *brilliant* btw.
My code includes the following:
In game.h:
map<string, string> idlist;
In Game.cpp:
void Game::addID(string id)
{
auto eltp = idlist.find(id);
if (eltp == map::end) {
idlist.insert(pair<string,string>(id, id));
} else {
// Found in map, so it's a duplicate
string emsg = "Duplicate ID: %s";
emsg += id;
yyerror(emsg);
}
}
=====
My make log includes the following error message:
g++ -c -o Game.o Game.cpp
Game.cpp: In member function ‘void Game::addID(std::string)’:
Game.cpp:12:10: error: ‘eltp’ does not name a type
auto eltp = idlist.find(id);
^
Game.cpp:13:9: error: ‘eltp’ was not declared in this scope
if (eltp == map::end) {
^
This seems to imply that g++ is using the old meaning of "auto":
allocate the variable on the stack. Yet my gcc/g++ identifies as version
5.3.0, which the docs claim supports C++ version 11.
Do I have to add a command-line flag to enable C++ version 11 and/or the
new meaning of "auto"?
FWIW, I'm using gcc in the gcc package of cygwin 2.5.0 (32-bit)
--
On Beta, we'd have earrings for that. You could buy them in any jewelry
store. http://www.conchord.org/xeno/bdgsig.html