among many pitfalls in C++ there is so called “most vexing parse”. as the name suggests, it is vexing. especially that it is a heritage from C.
consider given code:
#include <iostream> struct S { S(){ std::cout<<"S()\n"; } S(const S&){ std::cout<<"S(cpctor)\n"; } }; int main(void) { S s( S() ); return 0; }
what will show on the screen? if your answer wasn't “nothing”, that read on on explanation on the most vexing parse1)…