Date: Tue, 25 Apr 2023 10:47:02 -0600
The idea is to simply to add an interface to std::fstream::open <https://en.cppreference.com/w/cpp/io/basic_fstream/open> that provided an fstream to "a temporary file with a unique auto-generated filename” opened with “wb+x” mode - like that produced by std::tmpfile <https://en.cppreference.com/w/cpp/io/c/tmpfile>. This would solve a seemingly otherwise vexing task of re-inventing the standard library’s existing wheels for using FILE* under the hood for std::cin, std::cout, etc without needing to expose a FILE* based interface which could still be done but orthogonally.
This could be achieved simply by offering a no-parameters version of the aforementioned open member function:
void open();
Which to me at least, naturally suggests opening an unnamed file that was unique to the call and open for “wb+” access.
I tried searching for whether this had been proposed before. Closest I found were emails proposing an interface taking a FILE*.
Bad idea?
Lou
This could be achieved simply by offering a no-parameters version of the aforementioned open member function:
void open();
Which to me at least, naturally suggests opening an unnamed file that was unique to the call and open for “wb+” access.
I tried searching for whether this had been proposed before. Closest I found were emails proposing an interface taking a FILE*.
Bad idea?
Lou
Received on 2023-04-25 16:47:14