Explores implementing binary trees in C++ using unique_ptr instead of raw pointers with new/delete. Benchmarks show unique_ptr adds slight overhead compared to raw pointers (1.7-2.2x slower than vector-based approach vs 1.4-1.7x), but provides safer memory management. The author discusses trade-offs between pointer-based and index-based implementations, noting that vector approaches remain faster due to allocation efficiency, though pointer-based solutions require mechanisms to maintain pointer validity that add complexity.

3m read timeFrom meetingcpp.com
Post cover image

Sort: