> The reason they picked operator<< is that it looks like arrows pointing to the left,
> which makes sense because the thing on the right is written/outputted to the thing on the left.
The key decisions was to separate formatting from buffering, and to use the type-safe expression syntax (relying on operators << and >>). I made these decisions after discussions with my colleague Doug McIlroy at AT&T Bell Labs. I chose << and >> after experiments showed alternatives, such as < and >, comma, and = not to work well. - Stroustrup |
We can think of many reasons why
<<
and
>>
were eventually chosen:
a. As Peter87 pointed out, looks like arrows pointing to the left
b. Also, as pointed pout, symmetric with respect to input and output
<<
and
>>
c. Not very commonly used as a built-in; with
stm < i
'less than' may be what comes to mind immediately.
d. Left-associative; so we can write
stm << i << j ;
e. Has reasonably low precedence; so we can write
stm << i + j ;