Skip to content

Conversation

bestxmg
Copy link

@bestxmg bestxmg commented Oct 14, 2024

I think it may be inexact in the modified line of this statement: vector<vector> ivec;
1: In the chapter 3.3(page 97), it says in the book that the definition of a vector to a vector will vary on different C++ version. I had tried it on my machine and verified it is right.
2: This statement is a default initialization (page 43), not a value initialization (page 132).
In C++, value-initializing a std::vector means creating a vector where its elements are explicitly initialized to their default values. For example:
std::vector<int> vec(5); // Initializes 5 elements, all set to 0 (value-initialized for int)

@bestxmg
Copy link
Author

bestxmg commented Oct 14, 2024

Snipaste_2024-10-14_20-44-09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant