Skip to content

Conversation

@jasonstratton
Copy link
Owner

…tings

@jasonstratton jasonstratton requested a review from Copilot June 25, 2025 08:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements a new Person interface with three concrete classes and replaces the "Hello, World!" example with randomized greetings.

  • Introduces Person as an abstract base and concrete Moe, Larry, Curley classes
  • Adds a printHello helper and random selection of person instances
  • Replaces simple output with a loop over randomly generated people
Comments suppressed due to low confidence (1)

main.cpp:24

  • [nitpick] Verify the spelling of Curley—if this refers to the Three Stooges character, the common spelling is Curly.
class Curley : public Person {

std::uniform_int_distribution<> dist(1, 10); // random number of persons
int numPersons = dist(gen);

std::vector<std::unique_ptr<Person>> people;
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider calling people.reserve(numPersons); after creating the vector to avoid repeated reallocations when pushing back numPersons elements.

Suggested change
std::vector<std::unique_ptr<Person>> people;
std::vector<std::unique_ptr<Person>> people;
people.reserve(numPersons); // Preallocate memory for numPersons elements

Copilot uses AI. Check for mistakes.
// Seed random number generator
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dist(1, 10); // random number of persons
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract the 1 and 10 bounds into named constants (e.g. kMinPersons, kMaxPersons) for clarity and easier updates.

Suggested change
std::uniform_int_distribution<> dist(1, 10); // random number of persons
std::uniform_int_distribution<> dist(kMinPersons, kMaxPersons); // random number of persons

Copilot uses AI. Check for mistakes.
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.

2 participants