I was doing an exercise while I noticed this
this code work okay:
std::vector<std::string> x = { "st1", "st1" };
std::vector<std::string> y = { "st1", "st1" };
assert(x == y);
while this give me error when trying to compile it
std::vector<std::string> x = { "st1", "st1" };
assert(x == { "st1", "st1" });
I have no idea why is that the case, could someone explain why and how to force it to compile if there is way to do it.
The error should have told you something along the line of "{ "st1", "st1" }
has no type".
If you want to construct a second vector you need to call the constructor:
assert(x == std::vector<std::string>{ "st1", "st1" });