Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Array Literal Overloads #1808

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/object.d
Original file line number Diff line number Diff line change
Expand Up @@ -3229,6 +3229,25 @@ template RTInfo(T)
enum RTInfo = null;
}

bool __equals(T1, T2, size_t n1)(auto ref T1[n1] lhs, T2[] rhs)
{
T1[] lhs1 = lhs;
return __equals(lhs1, rhs);
}

bool __equals(T1, T2, size_t n2)(T1[] lhs, auto ref T2[n2] rhs)
{
T2[] rhs1 = rhs;
return __equals(lhs, rhs1);
}

bool __equals(T1, T2, size_t n1, size_t n2)(auto ref T1[n1] lhs, auto ref T2[n2] rhs)
{
T1[] lhs1 = lhs;
T2[] rhs1 = rhs;
return __equals(lhs1, rhs1);
}

// lhs == rhs lowers to __equals(lhs, rhs) for arrays of all struct types.
// old path: Typeinfo_array => TypeInfo_struct
bool __equals(T1, T2)(T1[] lhs, T2[] rhs)
Expand Down