Template constructor in a class template – how to explicitly specify template argument for the 2nd parameter?

Fixing your code, the following would work: You cannot use T for the class template parameter and the constructor template parameter. But, to answer your question, from [14.5.2p5]: Because the explicit template argument list follows the function template name, and because conversion member function templates and constructor member function templates are called without using a function name, there is … Read more

-Error reading characters of string

4 getCarName likely returns a temporary. After the assignment the temporary object is destroyed and the pointer item.pszText points to invalid memory. You must ensure that the string object is valid during the call to ListView_InsertItem. The const_cast is an artifact of the fact that the Windows API uses the same structure to set and … Read more

How do you clear a stringstream variable?

For all the standard library types the member function empty() is a query, not a command, i.e. it means “are you empty?” not “please throw away your contents”. The clear() member function is inherited from ios and is used to clear the error state of the stream, e.g. if a file stream has the error … Read more

One or more multiply defined symbols found

Put the definition (body) in a cpp file and leave only the declaration in a h file. Include guards operate only within one translation unit (aka source file), not across all your program. The One Definition Rule of the C++ standard states that there shall appear exactly one definition of each non-inline function that is … Read more