
6 Nov
2003
6 Nov
'03
7:43 p.m.
"Joaquín Mª López Muñoz" <joaquin@tid.es> wrote
The following programs does not compile with error
foo.cpp: In function `int main()': foo.cpp:11: no matching function for call to `foo(std::string)'
Program code:
#include <boost/call_traits.hpp> #include <string>
template<typename Type> void foo(typename boost::call_traits<Type>::param_type x) { }
int main() { foo(std::string("bar"));
return 0; }
Compiler cannot deduce 'Type'. You have two options: 1. explicitly state type: foo<std::string>(std::string("bar")); 2. go to const& /Pavel