The idea is to simply to add an interface to std::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
. 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:
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*.