Void pointers

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 16 14:35:06 PDT 2016


Background:
Say, I have objects of kind E, which operate on structs of kind 
M. The problem: if an action is done on a struct, say M42, there 
should be also some action done on other structs, which have some 
relation to M42, but neither the operating object, nor M42 is 
aware of them (and the action which is required), as this would 
break encapsulation.
So, I choosed another approach:
There are some describing objects, say of kind B and G, which 
hold a specific information (a single property) of all existent M 
structs. These objects know which "neighbors" are also affected 
in case of some action of E on the struct M42 and can perform 
appropriate actions on them, at least on the contained property.
The problem which is still unsolved:
objects of kind E operates on structs M randomly. For this goal, 
they have to save the information between their actions, on which 
structs they are interested in, to report the ordinal number to 
the describing objects.
The saving of ordinal numbers with minimum computational costs 
(nogc, even no construction of iota-structs, etc) is crucial.



More information about the Digitalmars-d-learn mailing list