Closed pinkenburg closed 2 years ago
Which version of clang does your code support?
It appears your code (if that is the code you are referring to) already uses both boost::filesystem
and std::filesystem
https://github.com/sPHENIX-Collaboration/coresoftware/search?q=filesystem
Here is a few findings to document this issue better:
The posted screenshot shows a warning rather than an error. The warning is produced by clang only whereas gcc8 does not care about this even with all warnings enabled "-Wall -Wextra -Wpedantic"
The warning is to warn about an optimization which the compiler cannot do in the range loop but what it thinks the programmer is trying to achieve by using a reference type &
Switching from std::filesyste::path
back to std::string
is pointless because the former already provides an implicit type conversion operator to std::string
. See https://en.cppreference.com/w/cpp/filesystem/path/native and the Note that elaborates on operator string_type() const; (3)
:
The conversion function (3) is provided so that APIs that accept std::basic_string file names can use pathnames with no changes to code.
- For this reason, there is no need to
#include <filesystem>
from the standard library. Moreover, it is automatically included if one uses the header filexpload/xpload.h
Which version of clang does your code support?
xpload 0.8.1 results in a compilation error with clang: The Result struct now contains paths;
instead of the previous
std::vector paths;
I don't think I want to introduce another header file into all of our codes. If there is no very good reason to leave this as filesystem::path we should go back to strings
std::vector