Interfacing with C libs: weeding through C/C++ macros and such in header files

2019-01-13 Thread Alec Stewart via Digitalmars-d-learn
Hello all! So while I have a decent grasp on D, I've been having trouble figuring out specific projects that I could do in D, so I thought I'd maybe find a little C or C++ library I could transfer over to D. I decided to make my life easier and look for something that's just a single header f

Re: Interfacing with C libs: weeding through C/C++ macros and such in header files

2019-01-13 Thread Alec Stewart via Digitalmars-d-learn
On Sunday, 13 January 2019 at 23:23:50 UTC, Alex wrote: These three are members of the standard library in D. https://dlang.org/phobos/core_memory.html Ah, yea that's way easier. At first, I would suggest to try out some automatic converters, which are written by the community: https://wik

Operator overloading for size_t

2019-03-14 Thread Alec Stewart via Digitalmars-d-learn
I thought (for shits and giggles) to try and implement the Aho-Corasick algorithm[1]. I thought I'd start with a struct to represent the "interval": struct Interval { size_t d_start; size_t d_end; size_t size; this(size_t start, size_t end) { d_

Re: Operator overloading for size_t

2019-03-14 Thread Alec Stewart via Digitalmars-d-learn
On Thursday, 14 March 2019 at 18:25:17 UTC, H. S. Teoh wrote: On Thu, Mar 14, 2019 at 06:07:46PM +, Alec Stewart via Digitalmars-d-learn wrote: [...] bool opEquals(ref const Interval i) const { // probably would be a bit more than just this, but for this issue // let&#

Attempt at creating a simpler unique_ptr

2019-03-28 Thread Alec Stewart via Digitalmars-d-learn
I'm sure something like this has been posted quite a bit, but I thought I'd try this for the heck of it. Looking at unique_ptr.h, oof, that ugly. So this is what I have so far. This to note - since templates can't except function arguments, I thought I'd make use of alias arguments and Alia