Re: std::filesystem::path::append oddity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 18 Jun 2018 at 09:04, Jonathan Wakely wrote:
>
> On Sun, 17 Jun 2018 at 23:01, NightStrike <nightstrike@xxxxxxxxx> wrote:
> >
> > I'm probably missing something abundantly obvious here, but shouldn't these
> > two methods of appending be the same according to
> > https://en.cppreference.com/w/cpp/filesystem/path/append variants 2 and 3?
>
> https://en.cppreference.com/w/cpp/filesystem/path/append#Parameters
> seems pretty clear about the allowed parameters of the (2) and (3)
> overloads.
>
> Neither of them can be called with a path object.
>
> >
> > #include <filesystem>
> > #include <string>
> > namespace fs = std::filesystem;
> >
> > void f() {
> >         fs::path p;
> >         p /= fs::path("s");  // works
>
> This works because it calls (1).
>
> >         p.append(fs::path("s"));  // doesn't
>
> This is neither a valid argument for the "source" parameter, nor a
> pair of iterators.
>
>
> > }
> >
> > It appears like clang doesn't support it, either.  The downside here is
> > that it prevents being able to do the following:
> >
> > ifstream if { p.append(...).c_str() };
>
> It's a lot simpler to just do:
>
> ifstream if{p/q};

Or:

ifstream if{ p/=q };



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux