digitalmars.D - _based pointers in D?
- Robert (14/14) Jun 03 2010 Hi, is there a similar construct like a _based pointer in D?
- bearophile (6/7) Jun 04 2010 This is a cute feature, more docs here:
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (7/11) Jun 05 2010 Thanks for the hint using structs and the operator stuff. I will
Hi, is there a similar construct like a _based pointer in D? type __based( base ) declarator void *vpBuffer; struct llist_t { void __based( vpBuffer ) *vpData; struct llist_t __based( vpBuffer ) *llNext; }; The pointer vpBuffer is assigned the address of memory allocated at some later point in the program. The linked list is relocated relative to the value of vpBuffer. -- Robert M. Münch http://www.robertmuench.de
Jun 03 2010
Robert:Hi, is there a similar construct like a _based pointer in D?This is a cute feature, more docs here: http://msdn.microsoft.com/en-us/library/57a97k4e.aspx D doesn't have this feature, but you can try to implement it using a struct that defines opUnary!("*") and more. If your implementation comes out nicely and you are willing to share your code, then maybe Andrei can add it to Phobos2. Bye, bearophile
Jun 04 2010
On 2010-06-05 03:12:58 +0200, bearophile said:D doesn't have this feature, but you can try to implement it using a struct that defines opUnary!("*") and more. If your implementation comes out nicely and you are willing to share your code, then maybe Andrei can add it to Phobos2.Thanks for the hint using structs and the operator stuff. I will definetly look into it and share my stuff. I will need something like this in conjunction with memory-mapped-files. -- Robert M. Münch http://www.robertmuench.de
Jun 05 2010