The main difference between the [] operator and .at () is that .at () checks the bounds and throws an exception if the index goes out of bounds.
It looks like the standard library implementation that you are using is binding additional code for something when using an iterator. The only way to find the reason is to examine the linker map file for both versions and carefully examine the source code for the functions you are using, and possibly the generated assembly.
In general, if you want your code to be very small, you want to avoid using any standard library, because the functions there can take a lot of code and data with them. Even code that parses the command line in the format that main () expects can be quite large.
For comparison, try the following:
const char *input = "Oh hai there! :D\n"; while (*input) ITM_SendChar(*input++);
source share