Template:cpp/filesystem/error handling

来自cppreference.com

若内存分配失败,则任何不标记为 noexcept 的重载可能抛出 std::bad_alloc
不接受 std::error_code& 形参的重载抛出 std::filesystem::filesystem_error,构造时以 OS 错误码为错误码实参。 接受 std::error_code& 形参的重载将其设置 为 OS API 错误码,而未发生错误时则执行 ec.clear()