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

Commit

Permalink
Merge pull request #1808 from somzzz/arrayEq
Browse files Browse the repository at this point in the history
Array Literal Overloads
merged-on-behalf-of: Andrei Alexandrescu <[email protected]>
  • Loading branch information
dlang-bot authored Apr 13, 2017
2 parents 1f292ca + dc10926 commit 378615b
Showing 1 changed file with 19 additions and 0 deletions.
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

0 comments on commit 378615b

Please sign in to comment.