diff options
Diffstat (limited to 'euler/source/std')
-rw-r--r-- | euler/source/std/cstdio.cpp | 1 | ||||
-rw-r--r-- | euler/source/std/string.cpp | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/euler/source/std/cstdio.cpp b/euler/source/std/cstdio.cpp index 8c12a7c..485efc3 100644 --- a/euler/source/std/cstdio.cpp +++ b/euler/source/std/cstdio.cpp @@ -1,4 +1,5 @@ #include <cstdio> +#include <string> extern "C" FILE *fopen(const char *filename, const char *mode) { diff --git a/euler/source/std/string.cpp b/euler/source/std/string.cpp index 31c47a5..ae397b1 100644 --- a/euler/source/std/string.cpp +++ b/euler/source/std/string.cpp @@ -44,6 +44,7 @@ namespace std { value = value * base + c - 'A' + 10; else break; + ++i; } if (pos != 0) @@ -75,10 +76,11 @@ namespace std { } std::string operator +(std::string &&lhs, std::string &&rhs) { + size_t og_lhs_s = lhs.size(); std::string s = std::move(lhs); - s.resize(lhs.size() + rhs.size()); + s.resize(og_lhs_s + rhs.size()); for (size_t i = 0; i < rhs.size(); ++i) - s[lhs.size() + i] = rhs[i]; + s[og_lhs_s + i] = rhs[i]; rhs.clear(); return s; } |