Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch2 listing 2.12 improper with_capacity values? #67

Open
jangedoo opened this issue Dec 22, 2021 · 0 comments
Open

ch2 listing 2.12 improper with_capacity values? #67

jangedoo opened this issue Dec 22, 2021 · 0 comments

Comments

@jangedoo
Copy link

In listing 2.12 Rendering the Mandlebrot set,

image

let mut rows: Vec<_> = Vec::with_capacity(width); // <6>

hint number (6) says create rows with_capacity(width). Shouldn't that be ideally with_capacity(height) since we want to create height number of rows and passing height is much better?

Also few line below:

let mut row: Vec<usize> = Vec::with_capacity(height);

let mut row: Vec<usize> = should also have Vec::with_capacity(width) instead of Vec::with_capacity(height)

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

No branches or pull requests

1 participant