# | Line 25 | Line 25 | public: | |
---|---|---|
25 | ||
26 | Binary::Binary(std::string& string, bool signed_) : bytes(string.size() / 8, 0) | |
27 | { | |
28 | + | if (string.find_first_not_of("01") != std::string::npos) throw; |
29 | + | |
30 | std::string::size_type off(string.size() % 8); | |
31 | ||
32 | if (off != 0) | |
33 | { | |
34 | < | bytes.push_back(0); |
34 | > | bytes.push_back(0); |
35 | string.insert(0, 8 - off, signed_ && string[0] == '1' ? '1' : '0'); | |
36 | } | |
37 |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |