Re: How does this template work?

2019-06-18 Thread XavierAP via Digitalmars-d-learn
On Sunday, 16 June 2019 at 15:11:29 UTC, Robert M. Münch wrote: How does the observerObject Template and function work? I'm struggling because both use the same name and how is the template parameter R deduced/where is it coming from? Looks like it's somehow implicitly deduced. Eponymous

Re: How does this template work?

2019-06-18 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-06-17 20:53:28 +, aliak said: Less typing for one. Otherwise you'd have to write: auto observer = observerObject!int.observerObject(TestObserver()); Since code is many times more read than written I will never understand why the syntax is polluted to save some keystrokes, making

Re: How does this template work?

2019-06-17 Thread aliak via Digitalmars-d-learn
On Monday, 17 June 2019 at 18:25:24 UTC, Robert M. Münch wrote: On 2019-06-16 15:14:37 +, rikki cattermole said: observerObject is an eponymous template. What this means (in essence) is the symbol inside the template block == template block. Hmm... ok. Is there any reason to have these

Re: How does this template work?

2019-06-17 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-06-16 15:14:37 +, rikki cattermole said: observerObject is an eponymous template. What this means (in essence) is the symbol inside the template block == template block. Hmm... ok. Is there any reason to have these "eponymous templates"? I don't see any benefit... -- Robert

How does this template work?

2019-06-16 Thread Robert M. Münch via Digitalmars-d-learn
How does the observerObject Template and function work? I'm struggling because both use the same name and how is the template parameter R deduced/where is it coming from? Looks like it's somehow implicitly deduced. class ObserverObject(R, E...){...} template observerObject(E) {

Re: How does this template work?

2019-06-16 Thread rikki cattermole via Digitalmars-d-learn
On 17/06/2019 3:11 AM, Robert M. Münch wrote: How does the observerObject Template and function work? I'm struggling because both use the same name and how is the template parameter R deduced/where is it coming from? Looks like it's somehow implicitly deduced. class ObserverObject(R,