mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Use template to get member type instead
This commit is contained in:
parent
1ce37e6eda
commit
533207226b
|
@ -23,6 +23,7 @@ import std.exception;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.traits;
|
import std.traits;
|
||||||
|
import std.range;
|
||||||
|
|
||||||
struct UseMemberType {};
|
struct UseMemberType {};
|
||||||
|
|
||||||
|
@ -105,11 +106,11 @@ private void autowireMember(string member, Type)(shared(DependencyContainer) con
|
||||||
alias MemberType = typeof(__traits(getMember, instance, member));
|
alias MemberType = typeof(__traits(getMember, instance, member));
|
||||||
|
|
||||||
static if (isDynamicArray!MemberType) {
|
static if (isDynamicArray!MemberType) {
|
||||||
alias ElementType = typeof(__traits(getMember, instance, member)[0]);
|
alias MemberElementType = ElementType!MemberType;
|
||||||
auto instances = container.resolveAll!ElementType;
|
auto instances = container.resolveAll!MemberElementType;
|
||||||
__traits(getMember, instance, member) = instances;
|
__traits(getMember, instance, member) = instances;
|
||||||
debug(poodinisVerbose) {
|
debug(poodinisVerbose) {
|
||||||
printDebugAutowiringArray(typeid(ElementType), typeid(Type), &instance, member);
|
printDebugAutowiringArray(typeid(MemberElementType), typeid(Type), &instance, member);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug(poodinisVerbose) {
|
debug(poodinisVerbose) {
|
||||||
|
|
Loading…
Reference in a new issue