I've been reading std.conv and std.range, trying to figure out a
high-level way of converting a hex string to bytes. The only way
I've been able to do it is through pointer access:
import std.stdio;
import std.string;
import std.conv;
void main()
{
immutable char* hex = "deadbeef".toStrin
On Tue, Feb 06, 2018 at 06:33:02PM +, Ralph Doncaster via
Digitalmars-d-learn wrote:
> I've been reading std.conv and std.range, trying to figure out a
> high-level way of converting a hex string to bytes. The only way I've
> been able to do it is through pointer access:
>
> import std.stdio
On 02/06/2018 07:33 PM, Ralph Doncaster wrote:
I've been reading std.conv and std.range, trying to figure out a
high-level way of converting a hex string to bytes. The only way I've
been able to do it is through pointer access:
import std.stdio;
import std.string;
import std.conv;
void main(
On Tuesday, 6 February 2018 at 18:33:02 UTC, Ralph Doncaster
wrote:
I've been reading std.conv and std.range, trying to figure out
a high-level way of converting a hex string to bytes. The only
way I've been able to do it is through pointer access:
import std.stdio;
import std.string;
import
On Tuesday, 6 February 2018 at 18:33:02 UTC, Ralph Doncaster
wrote:
I've been reading std.conv and std.range, trying to figure out
a high-level way of converting a hex string to bytes. The only
way I've been able to do it is through pointer access:
import std.stdio;
import std.string;
import
On 2/6/18 1:46 PM, H. S. Teoh wrote:
Of course, this eagerly constructs an array to store the result, which
allocates, and also requires the hex string to be fully constructed
first. You can make this code lazy by turning it into a range
algorithm, then you can actually generate the hex digits l
On Tuesday, 6 February 2018 at 18:46:54 UTC, H. S. Teoh wrote:
On Tue, Feb 06, 2018 at 06:33:02PM +, Ralph Doncaster via
Digitalmars-d-learn wrote:
clip
OO is outdated. D uses the range-based idiom with UFCS for
chaining operations in a way that doesn't require you to write
loops yourse
On 02/06/2018 11:55 AM, Ralph Doncaster wrote:
> I'll have to do some more reading about
> maps. My initial though is they don't seem as readable as loops.
Surprisingly, they may be very easy to read in some situations.
> The chunks() is useful, so for now what I'm going with is:
> ubyte[
On 06/02/2018 8:46 PM, Craig Dillabaugh wrote:
On Tuesday, 6 February 2018 at 18:46:54 UTC, H. S. Teoh wrote:
On Tue, Feb 06, 2018 at 06:33:02PM +, Ralph Doncaster via
Digitalmars-d-learn wrote:
clip
OO is outdated. D uses the range-based idiom with UFCS for chaining
operations in a way
On Wednesday, 7 February 2018 at 03:25:05 UTC, rikki cattermole
wrote:
On 06/02/2018 8:46 PM, Craig Dillabaugh wrote:
On Tuesday, 6 February 2018 at 18:46:54 UTC, H. S. Teoh wrote:
[...]
clip
[...]
clip
[...]
Wouldn't it be more accurate to say OO is not the correct tool
for every job ra
On 07/02/2018 4:06 AM, Craig Dillabaugh wrote:
On Wednesday, 7 February 2018 at 03:25:05 UTC, rikki cattermole wrote:
On 06/02/2018 8:46 PM, Craig Dillabaugh wrote:
On Tuesday, 6 February 2018 at 18:46:54 UTC, H. S. Teoh wrote:
[...]
clip
[...]
clip
[...]
Wouldn't it be more accurate to
On Tuesday, 6 February 2018 at 18:33:02 UTC, Ralph Doncaster
wrote:
I've been reading std.conv and std.range, trying to figure out
a high-level way of converting a hex string to bytes. The only
way I've been able to do it is through pointer access:
import std.stdio;
import std.string;
import
On Wednesday, 7 February 2018 at 14:47:04 UTC, Ralph Doncaster
wrote:
p.s. the cast should probably be to immutable ubyte[]. I'm
guessing without it, there is an automatic copy of the data
being made.
No copy - you just get undefined behavior if you actually try to
modify it!
13 matches
Mail list logo