How to combine the need to localize a result for an if statement
and have to call a method to get proper comparison:
if (((auto x = X.value()).empty())
{
}
instead of having to do the long and winded way
auto x = X.value();
if (x.empty())
{
}
Many times I need the result of a function
I have to parse a cassv in to tokens but want to keep group
element that use comma's and spaces as as single token:
e.g.,
a /*b, c*/, d
should be split
a
b, c
d
and not
a /*b, c*/
d
or
a
b
c
d
using the rule (?Pregex)
e.g., (?P\w*)*
how do we get at all the matches, e.g., Joe Bob Buddy?
When I access the results captures they are are not arrays and I
only ever get the first match even when I'm using matchAll.
Is there a way to retain the ordering of an associative array?
When the elements are added then looped over using a foreach, the
order is different.
Can regex's have variables in them? I'd like to create a ctRegex
but match on runtime strings that are known at runtime.
e.g.,
auto c = ctRegex~("x{var}")
where var is a variable that is passed at runtime. e.g., match(s,
c, "test") will replace var with test.
The reason is I basically have
On Tuesday, 11 April 2017 at 03:00:29 UTC, Jon Degenhardt wrote:
On Tuesday, 11 April 2017 at 01:59:57 UTC, Jonathan M Davis
wrote:
On Tuesday, April 11, 2017 01:42:32 Jethro via
Digitalmars-d-learn wrote:
[...]
You can't reuse the memory of a dynamic array by simply
setting its length to 0
ctfe string appending is way to slow, I have tried the suggested
methods and nothing works and slows down by at least an order of
magnitude.
I need a drop in replacement(no other changes) that can take over
the duties of string and allow for memory reuse.
reserve, cpacity, assumeSafeAppend
I have a template that that takes no arguments. It takes a while
to compile, but if I simply create a dummy argument, D compiles
much quicker.
e.g.,
void foo(string s)(); // slow,
void foo(string s)(int x); // fast. (I, of course, pass a dummy
value for x)
This is because the compiler
arrays have the ability to reserve but when setting the length to
0, it removes the reserve!! ;/
char[] buf;
buf.reserve = 1000;
buf.length = 0;
assert(buf.capacity == 0);
But I simply want to clear the buffer, not change it's
reserve/capacity.
I've tried to hack by setting the length to 0
On Sunday, 9 April 2017 at 19:55:57 UTC, Stefan Koch wrote:
On Sunday, 9 April 2017 at 19:38:33 UTC, Jethro wrote:
[...]
The constructor is nuts.
You do not need to zero the string!
Also avoid templates if you can.
Please don't criticize banal stuff by choosing one meaningless
line and
I tried to make a string like replacement called fstring which
uses buffering to avoid lots of little allocations. The problem
is, that it actually causes the compiler to use 10x the memory
and about 10 times slower.
It doesn't do anything special but tries to emulate string(so it
can be a
void foo(A...)(A a)
{
foreach(aa; a)
{
for(int i = 0; i < a.length; i++)
...
}
}
A can be strings or char, how can I easily deal with both? (e.g.,
a.length = 1 for a being a char... and also a[0] = a, so to
speak).
That is, I want chars to be treated as
Suppose one has a function that will be used in CTFE and it uses
a lot of local variables. Does each call of the function end up
allocating space for these without ever releasing them or are
they reused? or used on the stack like normal?
I have a custom type and I'm trying to do things like
x~1 and 1~x.
I can get x~1 no problem by overriding the op "~" but how to I
get 1~x to convert 1 in to typeof(x)? instead of x in to
typeof(1) so to speak?
I really want D to realize that 1~x is suppose to use ~ of x, not
1.
How can I create a streaming server where I can stream live and
pre-recorded audio and video to http clients using html5 on the
client end?
Is it a simple matter of implementing the rtp/rtsp protocols and
such along with (d)encoding or is there a lot more work?
15 matches
Mail list logo