Hi!
I want to change a method ```Draw``` on a custom object when the
```MouseIn``` event occurs.
This is known as "Change State" of the object: ```Init``` ->
```Hovered```.
I want to change the state of an object by changing its class,
like this:
```d
this.__vptr = typeid(CLS).vtbl.ptr;
Is it possible to write like this in D?
```d
struct Message
{
ulong timestamp;
}
Message LongMessage
{
ubyte[255] s;
}
//
// it mean
//
// struct LongMessage
// {
// Message _super;
// alias _super this;
// ubyte[255] s;
// }
//
// or
//
// struct LongMessage
// {
//
On Sunday, 17 September 2023 at 15:55:37 UTC, Vitaliy Fadeev
wrote:
Is it possible to write like this in D?
```d
struct Message
{
ulong timestamp;
}
Message LongMessage
{
ubyte[255] s;
}
//
// it mean
//
// struct LongMessage
// {
// Message _super;
// alias _super this;
//
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
...
Playground: https://run.dlang.io/is/hjcLCk
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
It works! But I want to ask how to make this 100% the best of
the best?
What should I consider before changing ```__vptr``` ?
If that works for you with that constraint of having exact memory
layout then it should be ok.
I`ve just started learning d and have a question.
What should I write to set dinamyc rectangular array length in
both dimentions?
For example, I have declareted an array:
``` int[][] matrix;```
and want set it as n*n matrix.
Thanks
On Sunday, 17 September 2023 at 17:10:16 UTC, evilrat wrote:
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev
wrote:
It works! But I want to ask how to make this 100% the best of
the best?
What should I consider before changing ```__vptr``` ?
If that works for you with that
On Sunday, 17 September 2023 at 17:15:34 UTC, Timofey wrote:
I`ve just started learning d and have a question.
What should I write to set dinamyc rectangular array length in
both dimentions?
For example, I have declareted an array:
``` int[][] matrix;```
and want set it as n*n matrix.
Thanks
On Friday, 15 September 2023 at 16:55:34 UTC, Vino wrote:
On Friday, 15 September 2023 at 15:27:00 UTC, Vino wrote:
On Friday, 15 September 2023 at 02:25:09 UTC, Joe wrote:
On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote:
[...]
A pointer is a type that points to something. It's
On Sunday, 17 September 2023 at 17:15:34 UTC, Timofey wrote:
I`ve just started learning d and have a question.
What should I write to set dinamyc rectangular array length in
both dimentions?
For example, I have declareted an array:
```d
int[][] matrix;
```
and want set it as n*n matrix.
On Sunday, 17 September 2023 at 18:28:36 UTC, Joe wrote:
On Friday, 15 September 2023 at 16:55:34 UTC, Vino wrote:
[...]
[...]
char[] invalid = (cast(char*)malloc(char.sizeof * len))[0..len];
This is not the way to go about it. You are mixing "pointer
arrays" with "arrays".
[...]
11 matches
Mail list logo