On Friday, 29 December 2017 at 22:08:59 UTC, vit wrote:
n = Nullable!Object.init;
assert(n.isNull == true);
[...]
more:
https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@forum.dlang.org?page=1
Thanks.
No-one in the linked thread seemed to know why .destroy is used
in nullify. Looki
On Saturday, December 30, 2017 08:59:40 Chris Paulson-Ellis via Digitalmars-
d-learn wrote:
> On Friday, 29 December 2017 at 22:08:59 UTC, vit wrote:
> > n = Nullable!Object.init;
> > assert(n.isNull == true);
> >
> > [...]
> > more:
> > https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@f
import core.vararg;
string foo(fmt, ...) {
int args_len = _arguments.length;
if (args_len == 1) {
if (typeid(_arguments[0] == typeid(TypeInfo[]))) {
_arguments = va_arg!(TypeInfo[])(_argptr);
args_len = _arguments.length;
// how can I adjust _a
On Saturday, 30 December 2017 at 10:14:35 UTC, tipdbmp wrote:
// how can I adjust _argptr?
_argptr = ???
Try this:
_argptr = *cast(va_list*)_argptr;
how do I take a symbol as parameter?
for example:
template nameof(alias S) {
import std.array : split;
enum nameof = S.stringof.split(".")[$-1];
}
Works fine for say a enum member such nameof!(myEnum.X) but this:
struct S { int v; }
S s;
writefln(name
As an exercise in http://ddili.org/ders/d.en/pointers.html, I was
implementing a very stripped down version of singly linked list
like below:
struct Node(T)
{
T item;
Node!T* next_item;
}
string to_string(T)(in Node!T node)
{
import std.format;
return node.nextItem ? "%s -> %s".
On Saturday, 30 December 2017 at 15:00:32 UTC, helxi wrote:
As an exercise in http://ddili.org/ders/d.en/pointers.html, I
was implementing a very stripped down version of singly linked
list like below:
struct Node(T)
{
T item;
Node!T* next_item;
}
[...]
Correction, I meant:
If I leav
On 12/29/17 7:03 AM, Mike Franklin wrote:
Is that simply because it hasn't been implemented or suggested yet for
D, or was there a deliberate design decision?
It was deliberate, but nothing says it can't actually be done. All an
interface call is, is a thunk to grab the actual object, and the
On Friday, 29 December 2017 at 20:11:03 UTC, Seb wrote:
On Friday, 29 December 2017 at 19:38:44 UTC, aliak wrote:
Hi,
So when I'm dealing with ranges, there're a number of times
where I get the front of the returned result of a set of
operations, but of course there is no front so you get an
On Friday, 29 December 2017 at 20:47:44 UTC, Dukc wrote:
On Friday, 29 December 2017 at 19:38:44 UTC, aliak wrote:
So when I'm dealing with ranges, there're a number of times
where I get the front of the returned result of a set of
operations, but of course there is no front so you get an
runt
On Friday, 29 December 2017 at 20:33:22 UTC, Jonathan M Davis
wrote:
Well, I don't know what you're really doing in code here, but
in general, you'd write your code in a way that it checks empty
and simply doesn't try to do anything with front if the range
is empty.
Yes, ideally, if programme
On 12/30/17 3:59 AM, Chris Paulson-Ellis wrote:
On Friday, 29 December 2017 at 22:08:59 UTC, vit wrote:
n = Nullable!Object.init;
assert(n.isNull == true);
[...]
more:
https://forum.dlang.org/thread/jrdedmxnycbqzcpre...@forum.dlang.org?page=1
Thanks.
No-one in the linked thread see
On Saturday, 30 December 2017 at 19:00:07 UTC, aliak wrote:
On Friday, 29 December 2017 at 20:47:44 UTC, Dukc wrote:
[...]
Hmm, interesting. Not sure that's what I'm looking for but I
like it anyway :)
I'm more looking to deal with situations like this:
Instead of this:
auto result = ran
On Saturday, December 30, 2017 19:11:20 aliak via Digitalmars-d-learn wrote:
> On Friday, 29 December 2017 at 20:33:22 UTC, Jonathan M Davis
>
> wrote:
> > Well, I don't know what you're really doing in code here, but
> > in general, you'd write your code in a way that it checks empty
> > and simpl
On Sat, 30 Dec 2017 13:07:49 +, Marc wrote:
> how do I take a symbol as parameter?
>
> for example:
>
>> template nameof(alias S) {
>> import std.array : split;
>> enum nameof = S.stringof.split(".")[$-1];
>>}
>
> Works fine for say a enum member such nameof!(myEnum.X) but this:
>
On Saturday, 30 December 2017 at 19:00:07 UTC, aliak wrote:
Instead of this:
auto result = range.op!f;
if (!result.empty) {
result.front.method();
}
This:
range.op!f.ifFront.method();
Ah, so you don't have a problem with checking emptiness but you
want to do it inside the expressi
For me, front() should throw a pre-defined exception when called
on an empty range in order to eliminate undefined behavior. It
does take some time to make a check, but D does array bounds
checking by default. Ideally the front() check could be turned
off somehow ("-boundschecks=off") by the us
On Friday, 29 December 2017 at 23:13:20 UTC, Jonathan M Davis
wrote:
The term "slice" is a bit overused in D, meaning a variety of
things. It doesn't help that some folks dislike the official
terminology. In general, a slice is a contiguous group of
elements. A slice of memory would be a contig
double[] D = [3.14159];
Can you guess what D is? :D
On Sunday, 31 December 2017 at 03:08:05 UTC, Ivan Trombley wrote:
double[] D = [3.14159];
Can you guess what D is? :D
It took me a while but I finally came up with "a slice of pi"
On Sunday, 31 December 2017 at 03:57:17 UTC, Tony wrote:
On Sunday, 31 December 2017 at 03:08:05 UTC, Ivan Trombley
wrote:
double[] D = [3.14159];
Can you guess what D is? :D
It took me a while but I finally came up with "a slice of pi"
a slice of pi is irrational.
On Sunday, 31 December 2017 at 04:20:28 UTC, codephantom wrote:
On Sunday, 31 December 2017 at 03:57:17 UTC, Tony wrote:
On Sunday, 31 December 2017 at 03:08:05 UTC, Ivan Trombley
wrote:
double[] D = [3.14159];
Can you guess what D is? :D
It took me a while but I finally came up with "a sli
I came from C++ looking forward to D. Some languages require
programmers to use GC all the time. However, A lot of time we
don't really need GC especially when the time of destruction is
deterministic in compile time.
I found that struct in D is allocate on stack by default. And we
can use sc
On 12/30/2017 11:16 PM, Tim Hsu wrote:
> Struct version of Vector3f can't derive toString
> method. writeln() prints unformated struct members. I know I can use
> helper function here. But is there any other way?
The normal way that I know is to insert a function like the following
into Vector3
24 matches
Mail list logo