How to use the list of values enclosed by curly braces to assign values in curly braces 11
The main content of this article is to explain "how to assign values surrounded by curly braces in curly braces 11". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to assign values surrounded by curly braces in curly braces 11.
What's New in Category 11 (2)-list initialization
In addition to initialization, this form can also be used in assignment statements. Let's review what happened when the variable was initialized:
Vector vi {1, 2, 3, 4, 5}
The following is the case of assignment:
Vector vi
Vi = {6,7,8,9,10}
This form is very useful for the assignment of a limited number of values.
Supplement
A list of values surrounded by curly braces has the same advantage as initialization. One is to prevent narrowing, which can sometimes be simply understood to prevent a reduction in precision, for example, the following code cannot be compiled:
Double pai = 3.1415926
Int pi
Pi = {pai}; / / compilation error.
In addition, if the initialization list in curly braces is empty, the compiler creates a temporary amount of value initialization and assigns a value to the assignment object.
At this point, I believe you have a deeper understanding of "how to assign values surrounded by curly braces in curly braces 11". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!