Re: How should I move in a DList ?

2020-05-13 Thread Gabriel via Digitalmars-d-learn
On Wednesday, 13 May 2020 at 14:29:53 UTC, Steven Schveighoffer 
wrote:
I would never recommend either DList or SList for actual linked 
lists (for stacks or queues, they are OK), as they are very 
unweildy and don't do what most people want linked lists to do.


-Steve

[1] https://github.com/schveiguy/dcollections


Thanks a lot for this answer, I think the doubly-linked-list I 
found on Rosetta Code will do the job.


How should I move in a DList ?

2020-05-13 Thread Gabriel via Digitalmars-d-learn

Hello,

As I am totally new to D (my background is mainly C++) I am 
having trouble porting an algorithm that simplifies a polyline in 
2D, very similar to this one: 
http://psimpl.sourceforge.net/reumann-witkam.html


Here is what I would like:
1) Use a doubly-linked list, preferably one from a standard 
library (I need fast insertion/removal anywhere inside the list).
2) Have multiple "cursors" (ref to a list node, pointers, 
iterators etc.) that I move forward in my list when needed.
3) Remove and add some elements in the list (at/between "cursor" 
positions).


I am fine with having "unsafe" code for this example (the 
function is 43 lines long in C++, does not have too many cases 
and would be tested on a lot of data).


What "cursor" should I use to get something similar to C++'s 
std::list's iterators, or C#'s LinkedListNode that I was able to 
use to port the algorithm in C++ and C# ? (I am benching 
languages).


Thanks in advance,



Re: Messing with OpenGL in D

2018-12-05 Thread Gheorghe Gabriel via Digitalmars-d-learn
On Wednesday, 5 December 2018 at 19:12:34 UTC, Nadir Chowdhury 
wrote:
I'm fairly new to Dlang, but have learnt the basics. I wondered 
how I would be able to make an OpenGL-based Engine in D, what 
libraries would I need? Your help will be much appreciated!


- NCPlayz


I use BindBC-OpenGL for my game engine.
To handle windows and input you can either use BindBC-GLFW (like 
me) or BindBC-SDL2.

It's very nice and easy.
I hope it helped.
Good luck!


Address problem

2017-10-24 Thread Gheorghe Gabriel via Digitalmars-d-learn

Hi,
---
interface I { }

I[string] i;

class C : I {
this() {
i["s"] = this;
foreach (_i; i) {
writeln(&_i);
}
foreach (ref _i; i) {
writeln(&_i);
}
}
}

void main() {
C c = new C;
writeln(&c);
}
---
output:
19FDD8
2802028
21FE58
---
I need that I["s"] to have the same address like c.