Build your own Trie entry table

2016-12-26 Thread Remi Thebault via Digitalmars-d-learn
Hello I want to map a dchar to its Bidi_Class. I've built an utility that reads UnicodeData.txt into an AA and builds a trie with std.uni.codepointTrie from it. I use Trie.store() to export the trie entry table into a D module. (I believe in a similar manner than phobos' unicode_tables.d) N

Re: Build your own Trie entry table

2016-12-28 Thread Remi Thebault via Digitalmars-d-learn
On Tuesday, 27 December 2016 at 19:19:49 UTC, Dmitry Olshansky wrote: On Monday, 26 December 2016 at 10:12:20 UTC, Remi Thebault wrote: Now I want to use this table to efficiently create a Trie in my code, the same way std.uni does, but found out that Trie constructor is private. Please f

How to get instance member value from getSymbolsByUDA

2022-02-26 Thread Remi Thebault via Digitalmars-d-learn
Hi all, I'm trying to establish a REST API by using the type system (used in both client and server code). Considering the code ```d struct Request { Method method; string url; int apiLevel; } @Request(Method.GET, "/my-resource/%s", 1) struct MyResourceGet { @Param string

Re: How to get instance member value from getSymbolsByUDA

2022-02-26 Thread Remi Thebault via Digitalmars-d-learn
On Saturday, 26 February 2022 at 11:26:54 UTC, max haughton wrote: On Saturday, 26 February 2022 at 10:39:18 UTC, Remi Thebault wrote: Hi all, I'm trying to establish a REST API by using the type system (used in both client and server code). [...] https://dlang.org/phobos/std_traits.html#g

Re: How to get instance member value from getSymbolsByUDA

2022-02-26 Thread Remi Thebault via Digitalmars-d-learn
On Saturday, 26 February 2022 at 12:01:14 UTC, max haughton wrote: Getting the UDAs from inside a symbol must be done via a recursive procedure in the same manner one would identify the aforementioned symbol i.e. you have to go through the fields looking for UDAs *then* use getUDAs. This is

Re: Multidimensional slice

2014-08-09 Thread Remi Thebault via Digitalmars-d-learn
Hello D-community Sorry to dig an old post, but I have the exact same need. I have C++ background and I started to use D a few days ago only (a pity I didn't start sooner!) My needs are mostly around numerical calculations. I have a safe and efficient matrix type in C++ that I am porting to D.

Re: Multidimensional slice

2014-08-10 Thread Remi Thebault via Digitalmars-d-learn
On Saturday, 9 August 2014 at 21:03:45 UTC, H. S. Teoh via Digitalmars-d-learn wrote: I think you need 2.066 or later to get this to work. After adding (size_t dim) to opSlice, your code compiles fine with git HEAD. Hi Thanks for the quick reply. Indeed I can get it to work with 2.066 Remi

Crash writing and reading back class instance address to void*

2014-08-18 Thread Remi Thebault via Digitalmars-d-learn
Hi Starting to use GtkD TreeModel, I write an instance of an abstract class to TreeIter.userData. When reading back the void pointer and casting to my abstract class leads to crash when instance is used (Task is the abstract class): int fillIter(TreeIter iter, Task t) {

Re: Crash writing and reading back class instance address to void*

2014-08-18 Thread Remi Thebault via Digitalmars-d-learn
Classes are reference types. You take reference of local reference (it's address on stack). Use just cast(void*)t Thank you!

Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread remi thebault via Digitalmars-d-learn
Hello I have this weird error trying to achieve something simple: module list_test; // import wayland.util; template Id(alias a) { alias Id = a; } template ParentOf(alias member) { alias ParentOf = Id!(__traits(parent, member)); } template wl_container_of(alias member) { ParentOf

Re: Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread remi thebault via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 22:12:38 UTC, anonymous wrote: Slapping `static` on `get` seems to make it work: static size_t get() {return member.offsetof;} Good slap, thanks! you solved my problem I guess the compiler thinks that since `item.link` is an instance member, it ne

Dynamic bindings to global variables

2015-08-02 Thread remi thebault via Digitalmars-d-learn
Hello I wrote static bindings to a C library. I want to also offer a version(Dynamic) of the bindings. I follow and use derelict-util to get the address of function pointers. In the library I bind, there is also global variables. here's one example in the static bindings: extern __gshared

Re: Dynamic bindings to global variables

2015-08-02 Thread remi thebault via Digitalmars-d-learn
On Sunday, 2 August 2015 at 15:38:34 UTC, Mike Parker wrote: You have to declare it as a pointer, then retrieve the pointer in the same way you do the function pointers, via the system loader (GetProcAddress/dlsym). and how would you make this source compatible with the static binding version

Re: Dynamic bindings to global variables

2015-08-02 Thread remi thebault via Digitalmars-d-learn
On Sunday, 2 August 2015 at 16:20:29 UTC, remi thebault wrote: On Sunday, 2 August 2015 at 15:38:34 UTC, Mike Parker wrote: You have to declare it as a pointer, then retrieve the pointer in the same way you do the function pointers, via the system loader (GetProcAddress/dlsym). and how would