There is a project that needs to write a CSV file to render the data. On GitHub There is a lightweight read-write library minicsv on CSV, so download it. However, the following issues occurred when compiling example:
In file included from example.cpp:1:0:
minicsv.hpp:In function ' csv::ofstream& operator<< (csv::ofstream&, const t&) ':
Minicsv.hpp:326:38:error:no matching function for call to ' Csv::ofstream::escape_and_output (std::basic_ostringstream <char>::__string_type) '
Ostm.escape_and_output (Os_temp.str ());
^
Minicsv.hpp:326:38:note:candidate is:
Minicsv.hpp:266:8: Note:void csv::ofstream::escape_and_output (std::string&)
void Escape_and_output (std::string & SRC)
...
A lot of mistakes, no longer posted, occupy space. These errors all come from the same function header. The function header is defined like this:
void Escape_and_output (std::string & SRC)
And this is the way it is called:
Ostm.escape_and_output (Os_temp.str ());
Obviously, the function header at the time of invocation is called Rvalue reference, and the actual function header gives the Lvalue reference, the two do not match, so the compiler error. The modification is very simple, "&" instead of "&", that is, the function head changed to this appearance:
void Escape_and_output (std::string & SRC)
The mistake is very water, originally also did not want to write, but feared to the c++0x unfamiliar person will be overwhelmed, therefore affixed it. And I don't know why there's this obvious mistake in the project--maybe the boss's compiler is too smart.
For more related articles, please follow topic.alibabacloud.com (www.php.cn)!