www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15234] New: BigInt's ctor should accept a string range

https://issues.dlang.org/show_bug.cgi?id=15234

          Issue ID: 15234
           Summary: BigInt's ctor should accept a string range
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

import std.BigInt;

struct MyString {
    string data;

    this(string input) {
        data = input;
    }
    char front() {
        // return the next value in the sequence
        return data[0];
    }
    void popFront() {
        // move the front of the sequence to the next value
        data = data[1 .. $];
    }
    bool empty() {
        // true if the range has no more values to return
        return data.length == 0;
    }
}

void main() {
    BigInt a = BigInt(MyString("100"));
}

--
Oct 22 2015