Skip to content

Commit

Permalink
Improve restraints for readln
Browse files Browse the repository at this point in the history
  • Loading branch information
monarchdodra committed Jul 2, 2013
1 parent 73cd4b9 commit 3cd2060
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions std/stdio.d
Expand Up @@ -917,7 +917,7 @@ by $(D buf), whereas $(D buf = stdin.readln()) makes a new memory allocation
with every line.
*/
size_t readln(C)(ref C[] buf, dchar terminator = '\n')
if ((is(C == char) || is(C == wchar) || is(C == dchar)) && !is(C == enum))
if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum))
{
static if (is(C == char))
{
Expand All @@ -940,7 +940,7 @@ with every line.

/** ditto */
size_t readln(C, R)(ref C[] buf, R terminator)
if ((is(C == char) || is(C == wchar) || is(C == dchar)) && !is(C == enum) &&
if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum) &&
isBidirectionalRange!R && is(typeof(terminator.front == dchar.init)))
{
auto last = terminator.back;
Expand Down Expand Up @@ -2002,14 +2002,14 @@ if (isSomeString!S)
}
/** ditto */
size_t readln(C)(ref C[] buf, dchar terminator = '\n')
if ((is(C == char) || is(C == wchar) || is(C == dchar)) && !is(C == enum))
if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum))
{
return stdin.readln(buf, terminator);
}

/** ditto */
size_t readln(C, R)(ref C[] buf, R terminator)
if ((is(C == char) || is(C == wchar) || is(C == dchar)) && !is(C == enum) &&
if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum) &&
isBidirectionalRange!R && is(typeof(terminator.front == dchar.init)))
{
return stdin.readln(buf, terminator);
Expand Down

0 comments on commit 3cd2060

Please sign in to comment.