Skip to content

ch2 listing 2.12 improper with_capacity values? #67

Open

Description

@jangedoo

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)

Activity

  1. Dchll commented on Feb 25, 2025

    @Dchll

    I think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions