diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2020-06-27 18:31:53 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2020-06-27 18:31:53 -0400 |
commit | e395be3782f7adf92dbdd1e7438ea038eebecdf3 (patch) | |
tree | a811e4d8f860c9df46ed4400f71dab4e79151a4f | |
parent | eeb04bad15e33226250ad16304a4f23aec5d3fa2 (diff) |
Use end() in constructor
-rw-r--r-- | to_string.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/to_string.hpp b/to_string.hpp index b9e0cce..11e5906 100644 --- a/to_string.hpp +++ b/to_string.hpp @@ -32,9 +32,9 @@ class to_string_t { * Constructs the object, filling `buf` with the string representation of N. */ constexpr to_string_t() noexcept { + auto ptr = end(); + *--ptr = '\0'; if (N != 0) { - auto ptr = buf + sizeof(buf) / sizeof(buf[0]); - *--ptr = '\0'; for (auto n = N < 0 ? -N : N; n; n /= base) *--ptr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[n % base]; if (N < 0) |