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, E...){...}

template observerObject(E)
    ObserverObject!(R, E) observerObject(R)(R range)
        return new ObserverObject!(R, E)(range);

struct TestObserver {...}

auto observer = observerObject!int(TestObserver());

observerObject is an eponymous template.

What this means (in essence) is the symbol inside the template block == template block.

Yes R is being inferred by the argument.

Reply via email to