error: no matching function for call to ‘ptr_fun(<unresolved overloaded function type>)’
2011-01-04 10:31
1041 查看
下面这段代码会报错:报错信息为error: no matching function for call to ‘ptr_fun(<unresolved overloaded function type>)
#include <algorithm>
#include <cctype>
#include <string>
const std::string StrToUpper(std::string s)
{
std::transform(s.begin(), s.end(), s.begin(),std::ptr_fun(std::toupper));
return s;
}
Solution
Explicitly add the template parameters:
#include <algorithm>
#include <cctype>
#include <string>
const std::string StrToUpper(std::string s)
{
std::transform(s.begin(), s.end(), s.begin(),std::ptr_fun(std::toupper));
return s;
}
Solution
Explicitly add the template parameters:
#include <algorithm> #include <cctype> #include <string> //From http://www.richelbilderbeek.nl/CppStrToUpper.htm const std::string StrToUpper(std::string s) { std::transform(s.begin(), s.end(), s.begin(),std::ptr_fun<int,int>(std::toupper)); return s; } |
相关文章推荐
- error: no matching function for call to ‘boost::thread::thread(<unresolved overloaded function type>
- Qt error ------ no matching function for call to QObject::connect(QSpinBox*&, <unresolved overloaded function type>, QSlider*&, void (QAbstractSlider::*)(int))
- error: no matching function for call to 'std::basic_ifstream<char>::open(std::string&)
- error: no matching function for call to 'std::basic_ifstream<char>::open(std::string&)
- error: no matching function for call to 'std::basic_ifstream<char>::open(std::string&)
- no matching function for call to ‘std::basic_string<char>::assign(std::string&, int)
- error: no matching function for call to
- error: no matching function for call to 'MainWindow::connect(*&, ...)
- error: no matching function for call to 'std::exception:exception(const char[16])
- caffe编译Matlab接口报错:208: 4: error: no matching function for call to remove_if
- error: no matching function for call to 'std::exception:exception(const char[16])'
- error: extra qualification 以及 error: no matching function for call to
- no matching function for call to ‘transform
- 【求助】 no matching function for call to `strcpy(std::string&, char*&)'
- Uncaught TypeError: Object #<HTMLCollection> has no method 'toLowerCase'问题
- vector排序问题<unresolved overloaded function type>
- no matching function for call to ‘transform
- C++中错误no matching function for call to transform
- NDK编译出现找不到函数定义 no matching function for call to
- Qt:no matching function for call to (类名)::connect()的错误原因总结