This question aims for using std::byte
with standard input-output.
Are there any plans to add proper function overloads for read(_bytes)
and write(_bytes)
to the interfaces of basic_istream<CharT>
and basic_ostream<CharT>
in a future standard? What reasons speak against it? I understand that the CharT*
-overloads should be kept. What can I do to use std::byte
? I currently define in my project functions
std::istream& read(std::istream&, std::byte*, std::streamsize)
std::ostream& write(std::ostream&, const std::byte*, std::streamsize)
These use reinterpret_cast<>
to char*
resp. const char*
but I believe this depends on the size of char
. Am I wrong? Is char
always 1 byte
?
I tried to make std::basic_istream<std::byte>
but it is missing std::char_traits<std::byte>
and so on. Did anyone make this kind of thing work already?