Re: How to create a template class using foreach delegate to filter objects in a member function call?

2019-06-01 Thread Alex via Digitalmars-d-learn
On Saturday, 1 June 2019 at 14:24:11 UTC, Robert M. Münch wrote: The myFilter struct is the implementation which myClass.put() should use to iterate over all objects. Which ones? The E-objects, or the objects contained in myClass, which you don't want to know about? All things being only

Re: How to create a template class using foreach delegate to filter objects in a member function call?

2019-06-01 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-06-01 04:43:13 +, Alex said: That's ok, but could you provide an example anyway? Is it like this? ´´´ void main(){ auto target = new myClass!int(); target.objects.length = 4; auto val = 42; put(target, val, testfunction); // does the test function enters here?

Re: How to create a template class using foreach delegate to filter objects in a member function call?

2019-05-31 Thread Alex via Digitalmars-d-learn
On Friday, 31 May 2019 at 16:24:28 UTC, Robert M. Münch wrote: The code is just to show the problem and not meant to compile. I couldn't get anything to compile... That's ok, but could you provide an example anyway? Is it like this? ´´´ void main(){ auto target = new myClass!int();

Re: How to create a template class using foreach delegate to filter objects in a member function call?

2019-05-31 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-31 11:07:00 +, Alex said: Not sure, if I understood your problem correctly. I can imagine... I try my best :-) It is meant that the class myClass defines an array of myOtherClass objects? Yes. So there is one class having an array of other stuff. The code does not compile

Re: How to create a template class using foreach delegate to filter objects in a member function call?

2019-05-31 Thread Alex via Digitalmars-d-learn
On Thursday, 30 May 2019 at 18:34:31 UTC, Robert M. Münch wrote: I have myClass and I want to add a way where I can provide a delegate to iterate over myClass.objects when a member function put(...) of myClass is called. The idea is that a user of myClass can provide something like an