[Issue 11698] readf doesn't compile with bool

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 6 23:20:29 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11698



--- Comment #1 from Jerry Quinn <jlquinn at optonline.net> 2013-12-06 23:20:16 PST ---
Tracking this down further, the issue appears to be that formattedRead(range,
"%s", &bool) calls unformatValue!bool(range, formatSpec) which calls
parse!bool(range).

However, parse!bool doesn't seem to accept an input range:

import std.conv;
import std.range;
void foo() {
    string s = "1";
    auto ir = inputRangeObject(s);
    int i = parse!int(ir);    // OK

    string sb = "true";
    auto irb = inputRangeObject(sb);
    bool b2 = parse!bool(irb);   // Error
}


I *think* the problem is that 

Target parse(Target, Source)(ref Source s)
    if (isExactSomeString!Source &&
        is(Unqual!Target == bool)) { ... }

requires a string rather than an input range.  A version of parse!bool that
accepts a range would fix the problem.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list