C++ Logo


Advanced search

Subject: Re: [isocpp-lib-ext] D1030R4 draft 2: std::filesystem::path_view
From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-10-15 09:20:23

Niall Douglas wrote:

> Your mechanism would have that implicit and thus more subject to
> unintentional duplication of work performed, whereas the existing
> mechanism is explicit and less subject to surprise because it forces the
> user to spell things out.

Conversely, it also scopes the temporary buffer properly by default, whereas
you could easily duplicate and triplicate the stack space required unless
you scope the c_str<> variables by hand. But yes, I see your point.

> The Deleter can have state, just pass it in to the constructor.

In R4 it can. I was looking at R3, because, as you may have guessed, I had
to open it in order to look at the design rationale.

> If we insisted on Allocators, we would force a needless extra dynamic
> memory allocation and memory copy solely because we insisted on
> Allocators.

I don't see why.

SG16 list run by sg16-owner@lists.isocpp.org