C++: Declaration of parameter hides class member even with "this" keyword

At this level, those warnings are about setting best practices. Ensuring that your member variable names aren't the same as function parameter variable names is a good practice as far as making your code more readable. While "this->size" does remove the ambiguity, it also means the when you search for uses of size in that function, you have to check which variable you're referring to. Making the names different removes the ambiguity 2 months from now when you're fixing a bug :) Recommended fixes include either changing member variables to having a prefix such as m_size, which also has the benefit of improving auto-complete/intellisense, or changing parameter name.

I will note that warnings as errors and W4 is something I strongly recommend adhering to. Good on you for taking care of your code :)


but shouldn't the this keyword fix that confusion?

It's not that the compiler is confused about this->size being different than size. You will most likely get the warning even if you remove that line. The compiler is warning you about the fact that the argument name of the function hides the member name.