Our code was using something like below, to pass a const string reference:
const char& str = // passed in;
const std::string& sym(str);
Then I need to fix it for take symbol only as the first 5 chars, I did:
const std::string& sym(str, 5);
but this throws me this compiling error:
error: expression list treated as compound expression in initializer [-fpermissive]
Why can I invoke the first constructor, but no the second one?
Aucun commentaire:
Enregistrer un commentaire