P
Peng
Hi, I have encountered a simple but strange problem recently, with the STL
vector.
When I tried to compile a code like this, the compiler flags an error:
Error 212: "small.cc", line 200 # Argument type 'char *' does not match
expected parameter type 'const char (&)[9]'.
names.push_back(str);
^^^
can any one tell me why? Thanks.
Peng
PS the code
typedef char namestring [9]
typedef vector<namestring> NameArray; // name structure
NameArray names; // a global array
void lookup (namestring str)
{
names.push_back(str);
}
vector.
When I tried to compile a code like this, the compiler flags an error:
Error 212: "small.cc", line 200 # Argument type 'char *' does not match
expected parameter type 'const char (&)[9]'.
names.push_back(str);
^^^
can any one tell me why? Thanks.
Peng
PS the code
typedef char namestring [9]
typedef vector<namestring> NameArray; // name structure
NameArray names; // a global array
void lookup (namestring str)
{
names.push_back(str);
}