I have below sample code which I ran on visual studio 2019 and on https://godbolt.org/. I can see that there are two different behavior. What could be the possible reason ?
#include <iostream>
#include <filesystem>
int main()
{
std::filesystem::path p("//net");
std::cout << "root name of " << p << " is " << p.root_name() << std::endl;
}
Output in visualstudio 2019 : root name of "//net" is "//net"
Output in https://godbolt.org/ : root name of "//net" is ""
I Just read http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4100.pdf - 8.4.9 path decomposition [path.decompose] but did not understand the reason.
Also, I read below code in the std::filesystem
but din not understand completely
_NODISCARD path root_name() const {
// parse the root-name from *this and return a copy if present; otherwise, return the empty path
return _Parse_root_name(_Text);
}
Is there anyone who can explain me in more detail to understand the problem ?