#include <fstream>
#include <string>
bool touch(const std::string& file_path)
{
return std::ofstream(file_path, std::ios_base::app);
}
int main()
{
touch("foo.txt");
}
I2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiAKYm9vbCB0b3VjaChjb25zdCBzdGQ6OnN0cmluZyYgZmlsZV9wYXRoKQp7CglyZXR1cm4gc3RkOjpvZnN0cmVhbShmaWxlX3BhdGgsIHN0ZDo6aW9zX2Jhc2U6OmFwcCk7Cn0KIAppbnQgbWFpbigpCnsKCXRvdWNoKCJmb28udHh0Iik7Cn0K
prog.cpp: In function 'bool touch(const string&)':
prog.cpp:6:52: error: cannot convert 'std::ofstream {aka std::basic_ofstream<char>}' to 'bool' in return
return std::ofstream(file_path, std::ios_base::app);
^