Re: Associate information with a pointer address.

2023-10-01 Thread bachmeier via Digitalmars-d-learn
On Sunday, 1 October 2023 at 09:41:39 UTC, BoQsc wrote: The package dependency `emsi_containers` that can be found in https://code.dlang.org/packages/emsi_containers might be a viable way to resolve the problem. ``` /+dub.sdl: dependency "emsi_containers" version="~>0.7" +/ import std;

Re: Associate information with a pointer address.

2023-10-01 Thread BoQsc via Digitalmars-d-learn
The package dependency `emsi_containers` that can be found in https://code.dlang.org/packages/emsi_containers might be a viable way to resolve the problem. ``` /+dub.sdl: dependency "emsi_containers" version="~>0.7" +/ import std; void main(string[] args) @nogc { import containers;

Re: Associate information with a pointer address.

2023-09-29 Thread bachmeier via Digitalmars-d-learn
On Friday, 29 September 2023 at 14:31:54 UTC, BoQsc wrote: After being very happy about associative arrays of D Language, I encountered that they are not `@nogc`friendly. Unsure if I should wait for D language to support it, or do I need to rethink everything. You can work with AA's inside

Re: Associate information with a pointer address.

2023-09-29 Thread BoQsc via Digitalmars-d-learn
After being very happy about associative arrays of D Language, I encountered that they are not `@nogc`friendly. Unsure if I should wait for D language to support it, or do I need to rethink everything. Error ``` onlineapp.d(20): Error: assigning an associative array element in `@nogc`

Re: Associate information with a pointer address.

2023-09-29 Thread BoQsc via Digitalmars-d-learn
Out of scope access to a variable using stored pointer address, demonstration. ``` import std; void outofcontext() { writeln("Hello D ", associative); foreach (pointeraddress, information; associative) { writeln(*cast(string*)pointeraddress); } } static string[void* ]

Re: Associate information with a pointer address.

2023-09-29 Thread BoQsc via Digitalmars-d-learn
Bonus: Store hexadecimal literals in associative array of pointer addresses. ``` import std; void main() { string[void *] associative; // Store Hexadecimal as pointer address in associative array associative[cast(void *)0x7FFCD332CD60] = "someinformation"; // Store

Associate information with a pointer address.

2023-09-29 Thread BoQsc via Digitalmars-d-learn
For some reason I thought this was something I wanted to achieve and share. ``` import std; void main() { string variable; void * pointeraddress = string[void *] associative; associative[pointeraddress] = "someinformation"; writeln("Hello D ", pointeraddress);