Code RoomUnique ptr double delete
MediumPrep Room Coding #1805

Unique ptr double delete

Code reviewCode quality & reviewMid–Senior~25 min

Review this C++ ownership hand-off with unique_ptr.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1#include <memory>
2 
3struct Node { int v; };
4 
5void sink(Node* n) {
6 // takes ownership and frees it
7 delete n;
8}
9 
10void run() {
11 std::unique_ptr<Node> p = std::make_unique<Node>();
12 sink(p.get());
13}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.