Skip to content

Conversation

@Anshuman7080
Copy link

Memory Management: Using std::unique_ptr eliminates the need for manual memory management (malloc and free). This reduces the chances of memory leaks and dangling pointers.

Encapsulation: Encapsulated the linked list logic in a LinkedList class, which makes the code cleaner and adheres to object-oriented principles.

Modern C++: Utilized make_unique for creating nodes, which is a more modern and safer approach than using malloc.
Const-Correctness: The display function is marked as const, indicating that it does not modify the state of the linked list.

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