- Examples
Examples for using {} for uniform initialization and initializer lists.
We'll cover the following...
We'll cover the following...
Example 1
Explanation
-
Firstly, the direct initialization of the
C array, thestd::vector, and thestd::map(lines 32 - 34) is quite easy. In the case of thestd::map, the inner{}-pairs are the key and value pairs. -
The next special use case is the direct initialization of a const
C arrayon the heap (line 36). The special thing about the arrayarrin line 39 is thatC arrayscan be directly initialized in the ...