On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote:
Hi guys,
I ran into another snag this morning while trying to implement
a singleton. I found all kinds of examples of singleton
definitions, but nothing about how to put them into practice.
Can someone show me a code example fo
On Sunday, 3 February 2019 at 18:07:13 UTC, Chris Bare wrote:
auto matches = matchAll(str, searchRegex);
foreach (m; matches) // this walks the list forward
I tried:
foreach_reverse (m; matches)
foreach (m; reverse (matches))
foreach (m; retro (matches))
and they all failed to compile.
I also
On 2019-02-02 17:56, Ron Tarrant wrote:
Hi guys,
I ran into another snag this morning while trying to implement a
singleton. I found all kinds of examples of singleton definitions, but
nothing about how to put them into practice.
Can someone show me a code example for how one would actually
auto matches = matchAll(str, searchRegex);
foreach (m; matches) // this walks the list forward
I tried:
foreach_reverse (m; matches)
foreach (m; reverse (matches))
foreach (m; retro (matches))
and they all failed to compile.
I also tried to index matches (matches[i]) but that does not work
eit
On Sunday, 3 February 2019 at 16:36:30 UTC, Paul Backus wrote:
...
This is actually already in the standard library:
https://dlang.org/phobos/std_array.html#staticArray
thank you
either I already read that and forgot or finally I'm starting to
get the feel of the language :)
On Sunday, 3 February 2019 at 16:33:48 UTC, Emil wrote:
I tried this on a whim and it appears to work:
auto static_array(T, size_t data_size)()
{
T[data_size] data;
return data;
}
This is actually already in the standard library:
https://dlang.org/phobos/std_array.html#staticArray
I tried this on a whim and it appears to work:
auto static_array(T, size_t data_size)()
{
T[data_size] data;
return data;
}
void main() {
import std.stdio: writeln;
import std.traits: isStaticArray;
auto data = static_array!(int, 5)(3);
writeln(data);
static assert(_
On Sun, 2019-02-03 at 14:42 +, Ron Tarrant via Digitalmars-d-learn wrote:
> On Sunday, 3 February 2019 at 10:28:51 UTC, Alex wrote:
>
> > Isn't deriving a singleton even eviler as having one? ;)
>
> Perhaps this was meant as rhetoric, but I think you may be right.
>
> This morning I was Goog
On Sunday, 3 February 2019 at 10:28:51 UTC, Alex wrote:
Isn't deriving a singleton even eviler as having one? ;)
Perhaps this was meant as rhetoric, but I think you may be right.
This morning I was Googling "singleton replacement" and someone
on another forum said Factory would do the job. A
On Sunday, 3 February 2019 at 11:17:38 UTC, Jonathan M Davis
wrote:
I don't recall std.thread ever existing, and std.c.time hasn't
been around for a while. Thread is in core.thread, and all of
the C bindings for standard C and OS APIs are supposed to be in
druntime. So, the equivalent to C's
On Sunday, February 3, 2019 2:41:48 AM MST Ron Tarrant via Digitalmars-d-
learn wrote:
> On Saturday, 2 February 2019 at 19:40:25 UTC, Andre Pany wrote:
> > https://rosettacode.org/wiki/Singleton#D
>
> Do you know if this is for a current version of D? The compiler
> is choking on the import statem
On Sunday, 3 February 2019 at 09:46:20 UTC, Ron Tarrant wrote:
On Saturday, 2 February 2019 at 20:30:15 UTC, Neia Neutuladh
wrote:
And consider putting the class in its own source file.
Yes, by all means.
Speaking of which...
Considering the nature of a singleton such the one in the top
p
On Saturday, 2 February 2019 at 20:30:15 UTC, Neia Neutuladh
wrote:
And consider putting the class in its own source file.
Yes, by all means.
Speaking of which...
Considering the nature of a singleton such the one in the top
post, I can't see it being possible to use one as a base class
f
On Saturday, 2 February 2019 at 19:40:25 UTC, Andre Pany wrote:
https://rosettacode.org/wiki/Singleton#D
Do you know if this is for a current version of D? The compiler
is choking on the import statements, complaining that it can't
read std/thread.d and std/c/time.d
On Saturday, 2 February 2019 at 19:40:25 UTC, Andre Pany wrote:
I found here an example:
https://rosettacode.org/wiki/Singleton#D
Kind regards
Andre
Thanks, Andre. Exactly what I was hoping for.
15 matches
Mail list logo