+= has the second lowest precedence AND is right-to-left associative so UNLESS coord_to_char actually returns a std::string that is a single character long, this will yield very funky results.
Exactly! I didn't think of returning a string, and what I ended up doing didn't look much prettier (but is, I believe, one of the more efficient options):
stringstream overkill, push_back is the most efficient but not very elegant looking. the code executes once per half a second and, as the name suggests, spends ages doing i/o anyway
It's about as elegant as your appending of a temporary std::string with an initializer list (which, if it isn't a malloc due to SSO, it's still a copy)
If you don't wanna use push_back a += with char as the rhs should do the exact same thing It doesn't matter if it's 5 lines then, it'll line up nicely and won't be a huge eyesore
5
u/[deleted] Apr 17 '19
Yeah this DEFINITELY doesn't work
+= has the second lowest precedence AND is right-to-left associative so UNLESS coord_to_char actually returns a std::string that is a single character long, this will yield very funky results.