Compile error with templates - no matching function for call

前端 未结 2 1677
猫巷女王i
猫巷女王i 2021-02-15 16:01

I\'m trying to convert a string to a number. For that, I found the following way:

#include 
#include 

template 
         


        
2条回答
  •  广开言路
    2021-02-15 16:46

    Try

    int b = stringToNumber(a);
    

    Because the template type T can not be deduced from any of the parameters (in this case std::string) you need to explicitly define it.

提交回复
热议问题