From 533207226bbad3075872d0da26b6510c046c4d67 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 4 Jul 2015 14:09:05 +0200 Subject: [PATCH] Use template to get member type instead --- source/poodinis/autowire.d | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/poodinis/autowire.d b/source/poodinis/autowire.d index 01aa0f3..71b1697 100644 --- a/source/poodinis/autowire.d +++ b/source/poodinis/autowire.d @@ -23,6 +23,7 @@ import std.exception; import std.stdio; import std.string; import std.traits; +import std.range; struct UseMemberType {}; @@ -105,11 +106,11 @@ private void autowireMember(string member, Type)(shared(DependencyContainer) con alias MemberType = typeof(__traits(getMember, instance, member)); static if (isDynamicArray!MemberType) { - alias ElementType = typeof(__traits(getMember, instance, member)[0]); - auto instances = container.resolveAll!ElementType; + alias MemberElementType = ElementType!MemberType; + auto instances = container.resolveAll!MemberElementType; __traits(getMember, instance, member) = instances; debug(poodinisVerbose) { - printDebugAutowiringArray(typeid(ElementType), typeid(Type), &instance, member); + printDebugAutowiringArray(typeid(MemberElementType), typeid(Type), &instance, member); } } else { debug(poodinisVerbose) {