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;
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;
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
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`
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* ]
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
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);