I'm getting a warning in my constructor in my class, and I've never seen it before. This is what my constructor looks like.
Account(std::string n = "NULL", std::string i = "0", Stats s = (0,0,1) )
: name(n), id(i), stat(s) {}
If I remove any of these commas it results in a compile error, no? Is this warning incorrect, or is there something I can change to fix it?
The issue is this: (0,0,1)
.
That is parentheses around the expression 0,0,1
, which evaluates to 1
. (The comma operator is an infix operator that evaluates the first and second expression and returns the second. In this case, you have two such operators.)
I don't know what you wanted there, but I'm guessing that isn't it.
EDIT: It seems you want Stats s(0,0,1)
.