>"? I am wondering if there is a standard name for "<

What are the names of "<<" and ">>"?

I am wondering if there is a standard name for "<<and" →? This is mainly in the context of learning C ++ and using these operators as part of the stream I / O. If I need to read code or request student answers (e.g. cout << "Hello"; ), I'm not sure how to verbalize these characters. Is there a convention when you read them out loud?

+3
source share
5 answers

When not overloaded, left and right shift, and some people call them, even if they are used with streams, but inserting and retrieving in this context is much more common. They are also sometimes unofficially called “place” and receive. IIRC, Straustrup approved this last form.

+2
source

These are officially bitwise shift operators (for example, 1 << 3 equals 8), but they are often overloaded as stream / stream extraction operators (as in the cout example you specified).

+1
source

According to cplusplus.com documentation:

This operator (<<), applied to the output stream, is known as the insert statement .

...

And from the same site

This operator (→), applied to the input stream, is known as the extraction operator .

...

+1
source

<< is the insertion operator. Pay attention when you write

 cout << "Some text"; 

Arrows indicate flow. You insert text into the stream.

>> is the extraction operator. When you write

 cin >> some_var; 

You are retrieving a value from a stream.

+1
source

In his book, The C ++ Programming Language, C ++ 11, bjarne strustrup called <<"put" and "get from."

Hope this helps

+1
source

Source: https://habr.com/ru/post/1015719/


All Articles