February 15, 2023 [Issue 23707] New: File.rawRead/rawWrite should support reading/writing individual values | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: schveiguy@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. -- |
Copyright © 1999-2021 by the D Language Foundation