[Issue 23707] New: File.rawRead/rawWrite should support reading/writing individual values
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 15 03:22:54 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23707
Issue ID: 23707
Summary: File.rawRead/rawWrite should support reading/writing
individual values
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: schveiguy at gmail.com
Sometimes, you just want to read a byte (or write one). Doing so with rawRead
or rawWrite is awkward, because first you have to declare a buffer, then use
the buffer, then convert to the place where you actually want to use it. A
3-statement process is pretty inconvenient.
However, what if rawRead/rawWrite could have overloads that deal with one item:
```d
T rawRead(T)() if (!isArray!T) {...}
void rawWrite(T)(in T item) if (!isArray!T) {...}
```
Or stdio could provide wrappers that do this, they don't have to be overloads.
Just some way to do in one line what it currently takes 3 lines to do.
--
More information about the Digitalmars-d-bugs
mailing list