Does the answer depend on the number of bytes requested? If it is forced to keep a buffer due to some unknown device/diver, can it optimize and skip the buffer if it's going to be a disk read? I'm looking for any insight beyond "It's implementation dependent".
How I got here:
C++ implementations of POSIX compliant systems can bypass the basic_streambuf's process local buffers by directly calling the read() system call.
https://en.cppreference.com/w/cpp/io/basic_istream/read : When using a non-converting locale (the default locale is non-converting), the overrider of this function in std::basic_ifstream may be optimized for zero-copy bulk I/O (by means of overriding std::streambuf::xsgetn)
https://en.cppreference.com/w/cpp/io/basic_streambuf/sgetn : The rule about "more efficient implementations" permits bulk I/O without intermediate buffering: that's how std::ifstream::read simply passes the pointer to the POSIX read() system call in some implementations of iostreams
But the manual for read() (https://man7.org/linux/man-pages/man2/read.2.html) provides only input/output descriptions and does not say anything about implementation/guarantees provided by the system call. While reasonable for a standard to not be too heavy handed, it still raises the question - how is it actually implemented? And is it even an optimization over not having a buffer in std::basic_streambuf if the system call has a buffer anyway?