Skip to content

Commit

Permalink
std.array: Allow joining constant arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberShadow committed Jan 16, 2014
1 parent d81d540 commit ce7d4ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions std/array.d
Expand Up @@ -1525,7 +1525,7 @@ unittest
+/
ElementEncodingType!(ElementType!RoR)[] join(RoR, R)(RoR ror, R sep)
if(isInputRange!RoR &&
isInputRange!(ElementType!RoR) &&
isInputRange!(Unqual!(ElementType!RoR)) &&
isInputRange!R &&
is(Unqual!(ElementType!(ElementType!RoR)) == Unqual!(ElementType!R)))
{
Expand Down Expand Up @@ -1572,7 +1572,7 @@ ElementEncodingType!(ElementType!RoR)[] join(RoR, R)(RoR ror, R sep)
/// Ditto
ElementEncodingType!(ElementType!RoR)[] join(RoR)(RoR ror)
if(isInputRange!RoR &&
isInputRange!(ElementType!RoR))
isInputRange!(Unqual!(ElementType!RoR)))
{
alias typeof(return) RetType;

Expand Down Expand Up @@ -1601,6 +1601,10 @@ ElementEncodingType!(ElementType!RoR)[] join(RoR)(RoR ror)

assert(join([[1, 2, 3], [4, 5]], [72, 73]) == [1, 2, 3, 72, 73, 4, 5]);
assert(join([[1, 2, 3], [4, 5]]) == [1, 2, 3, 4, 5]);

const string[] arr = ["apple", "banana"];
assert(arr.join(",") == "apple,banana");
assert(arr.join() == "applebanana");
}

unittest
Expand Down

0 comments on commit ce7d4ed

Please sign in to comment.