Date: Sat, 06 Sep 2025 08:13:16 -0700
On Saturday, 6 September 2025 04:05:58 Pacific Daylight Time Jerome Saint-
Martin via Std-Proposals wrote:
> auto f = open_file<Mode::read>("data.txt");
> auto g = open_file<write | Mode ::binary>("log.bin");
We'll never get rid of the old API with this, because we may have:
std::ios::openmode mode = std::ios::in | std::ios::binary;
if (rw)
mode |= std::ios::out;
if (trunc)
mode |= std::ios::trunc;
since the above can't be done at constexpr time, either the old API must still
be taught or we'd have to write a 2^N combination of the new open_file<> calls.
And if we need to teach an API, we'll end up with the simplest.
Martin via Std-Proposals wrote:
> auto f = open_file<Mode::read>("data.txt");
> auto g = open_file<write | Mode ::binary>("log.bin");
We'll never get rid of the old API with this, because we may have:
std::ios::openmode mode = std::ios::in | std::ios::binary;
if (rw)
mode |= std::ios::out;
if (trunc)
mode |= std::ios::trunc;
since the above can't be done at constexpr time, either the old API must still
be taught or we'd have to write a 2^N combination of the new open_file<> calls.
And if we need to teach an API, we'll end up with the simplest.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Platform & System Engineering
Received on 2025-09-06 15:13:24