Skip to content

Commit

Permalink
Group encode overloads together again
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrel committed Dec 30, 2014
1 parent 3f942a2 commit 4b84951
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions std/encoding.d
Expand Up @@ -1841,6 +1841,20 @@ body
EncoderInstance!(E).encode(c,dg);
}

/**
Encodes $(D c) in units of type $(D E) and writes the result to the
output range $(D R). Returns the number of $(D E)s written.
*/
size_t encode(Tgt, Src, R)(in Src[] s, R range)
{
size_t result;
foreach (c; s)
{
result += encode!(Tgt)(c, range);
}
return result;
}

/**
Returns a foreachable struct which can bidirectionally iterate over all
code points in a string.
Expand Down Expand Up @@ -1948,21 +1962,6 @@ unittest
assert(a[2] == 0xAC);
}

/**
Encodes $(D c) in units of type $(D E) and writes the result to the
output range $(D R). Returns the number of $(D E)s written.
*/

size_t encode(Tgt, Src, R)(in Src[] s, R range)
{
size_t result;
foreach (c; s)
{
result += encode!(Tgt)(c, range);
}
return result;
}

/**
Convert a string from one encoding to another.
Expand Down

0 comments on commit 4b84951

Please sign in to comment.