While looking at some C++03 code, I found an instance of the most vexing parse that confused me:
#include <sstream>
#include <string>
int main(int, char** argv)
{
std::stringstream ss(std::string(argv[0]));
}
In the snippet above, ss
is a declaration to a function that takes a std::string*
and returns std::stringstream
.
How is std::string(argv[0])
being parsed as std::string*
?
Intuitively I thought that argv[0]
was unambiguously an access to argv
.