For some reason, I need to frequently generate strings use characters in {'0', '1', '2', '3'}. My current code use push_back() function and looks like:
string test = ""
test.push_back('0')
test.push_back('2')
test.push_back('3') // test would be "023"
I want to store the string in a char type or int type, and use binary form of each character to recursively generate the string. "023" would be stored in a char = '0010 1100'.
Do you think the binary operation is more time-efficient than push_back? If so, how to write the code.
Thanks!