the boolean type to convert to
the lvalue of an input range
the flag for deciding to report the number of consumed characters
A ConvException if the range does not represent a bool.
Note: All character input range conversions using to are forwarded to parse and do not require lvalues.
import std.typecons : Flag, Yes, No; auto s = "true"; bool b = parse!bool(s); assert(b); auto s2 = "true"; bool b2 = parse!(bool, string, No.doCount)(s2); assert(b2); auto s3 = "true"; auto b3 = parse!(bool, string, Yes.doCount)(s3); assert(b3.data && b3.count == 4); auto s4 = "falSE"; auto b4 = parse!(bool, string, Yes.doCount)(s4); assert(!b4.data && b4.count == 5);
$(PANEL The `parse` family of functions works quite like the $(LREF to) family, except that: $(OL $(LI It only works with character ranges as input.) $(LI It takes the input by reference. This means that rvalues (such as string literals) are not accepted: use `to` instead.) $(LI It advances the input to the position following the conversion.) $(LI It does not throw if it could not convert the entire input.)) )
This overload parses a bool from a character input range.