Using SonarLint for Visual Studio 4.35.0.32570
I define a method as this:
inline void WriteCsv(const CsvData& input, const std::wstring& filename, wchar_t delimiter)
{
std::wofstream myfile;
std::wstring a;
myfile.open(filename);
myfile << L"sep=" << delimiter << L"\n";
for (auto i = input.begin(); i != input.end(); ++i)
{
for (auto j = i->begin(); j != i->end(); ++j)
{
a = *j;
myfile << a << delimiter;
}
myfile << "\n";
}
myfile.close();
}
And I get a false positive on the filename parameter. If I fix the suggestion, I get an error on open that requests an explicit const ref wstring.
the same happens with an overload, so it’s not only with std methods:
inline void WriteCsv(const CsvData& input, const std::wstring& filename)
{
WriteCsv(input, filename, ';');
}