Compile error with templates - no matching function for call

前端 未结 2 1665
猫巷女王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:47

    You haven't supplied a template argument. Note that in C++11, you can use std::stoi:

    std::string a = "254";
    int b = std::stoi(a);
    

提交回复
热议问题