On Monday, 13 April 2020 at 04:21:48 UTC, Leonardo wrote:
foreach (ref gi; GameItems)
{
if (gi == Weapon)
gi.Attack()
}
How would it be?
Replying myself...
weapon = cast(Weapon) gi;
if (weapon !is null)
weapon.Attack()
can be simplified as:
if (auto weapon =
On Monday, 13 April 2020 at 04:15:04 UTC, Leonardo wrote:
On Monday, 13 April 2020 at 01:47:11 UTC, Adam D. Ruppe wrote:
On Monday, 13 April 2020 at 01:42:51 UTC, Leonardo wrote:
Is it possible to store different subclasses in one array?
In C#, we have this example, but how I do that in D?
On Monday, 13 April 2020 at 01:47:11 UTC, Adam D. Ruppe wrote:
On Monday, 13 April 2020 at 01:42:51 UTC, Leonardo wrote:
Is it possible to store different subclasses in one array?
In C#, we have this example, but how I do that in D?
Did you try
BaseItem[] GameItems;
GameItems ~= new
On Monday, 13 April 2020 at 02:22:33 UTC, Adam D. Ruppe wrote:
On Monday, 13 April 2020 at 02:20:39 UTC, Adnan wrote:
Now in the above inner loop getStr(node["com"].str()) crashes
in runtime if an array does not contain "com" node. I want to
avoid that. How should I proceed?
Try:
if("com"
In the following code, I want to process an json array (returned
by the value of "posts") that might or might not have "com" key.
If a "com" key does not exist, I want to ignore that item in the
json array.
uint[string] wordTable;
const auto j = parseJSON(get(link));
On Monday, 13 April 2020 at 02:20:39 UTC, Adnan wrote:
Now in the above inner loop getStr(node["com"].str()) crashes
in runtime if an array does not contain "com" node. I want to
avoid that. How should I proceed?
Try:
if("com" in node) {
}
On Monday, 13 April 2020 at 01:42:51 UTC, Leonardo wrote:
Is it possible to store different subclasses in one array?
In C#, we have this example, but how I do that in D?
Did you try
BaseItem[] GameItems;
GameItems ~= new Weapon();
yet?
Is it possible to store different subclasses in one array?
In C#, we have this example, but how I do that in D?
public class BaseItem{
public string name = "";
}
public class Weapon : BaseItem{
public int damage = 10;
}
public class Potion : BaseItem{
public int
On Sunday, 12 April 2020 at 23:14:42 UTC, Bruce Carneal wrote:
Could dlang compilers emit aliases for extern(C) and
extern(C++) routines that would carry dlang specific
information? (@safe, @nogc, nothrow, ...)
I'm thinking two symbols. The first as per normal C/C++, and
the second as per
Could dlang compilers emit aliases for extern(C) and extern(C++)
routines that would carry dlang specific information? (@safe,
@nogc, nothrow, ...)
I'm thinking two symbols. The first as per normal C/C++, and the
second as per normal dlang with a "use API {C, C++, ...}" suffix.
On 4/12/20 6:30 AM, Iain Buclaw wrote:
This is a regression caused by https://github.com/dlang/dmd/pull/10711
Thanks for finding that!
I wasn't sure where the culprit was.
-Steve
On Sunday, 12 April 2020 at 12:42:40 UTC, Harry Gillanders wrote:
On Sunday, 12 April 2020 at 11:17:39 UTC, realhet wrote:
I only remembered the __traits(identifier...), but completely
forgot about the getMember.
And I never heard of anySatisfy.
My JSON serializer is beautiful now.
Thank
On Sunday, 5 April 2020 at 14:19:40 UTC, WebFreak001 wrote:
On Sunday, 5 April 2020 at 14:02:19 UTC, Baby Beaker wrote:
On Saturday, 4 April 2020 at 21:54:34 UTC, Andre Pany wrote:
On Saturday, 4 April 2020 at 20:21:03 UTC, Marcone wrote:
[...]
[...]
If you can copy the D packages from the
On Sunday, 12 April 2020 at 11:17:39 UTC, realhet wrote:
Hello, anyone can help me make this better?
The functionality I want to achieve is: While serializing the
fields of a struct, I want it to check the @STORED UDA on every
field. If there is no fields are marked with @STORED, that
means
Hello, anyone can help me make this better?
The functionality I want to achieve is: While serializing the
fields of a struct, I want it to check the @STORED UDA on every
field. If there is no fields are marked with @STORED, that means
every field must be serialized. Otherwise only the marked
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer
wrote:
I'm building a library that uses vibe-core as an indirect
dependency. Specifically, I'm testing the library with dub test.
A very odd thing happens as I'm picking off compiler errors one
at a time. After all the errors that
16 matches
Mail list logo