Tagged articles

copy constructor

4 articles · Page 1 of 1
Deepin Linux
Deepin Linux
Jul 27, 2026 · Fundamentals

Master C++ Inc/Dec, Move, Copy, Reset, Destroy to Avoid Interview Pitfalls

This article systematically explains C++ reference‑count changes, the precise moments when ++/-- operators trigger in shared_ptr, move, copy, reset and destroy operations, and illustrates common mistakes with concrete code examples, helping developers and interviewees avoid subtle bugs and logic errors.

C++copy constructorincrement operator
0 likes · 20 min read
Master C++ Inc/Dec, Move, Copy, Reset, Destroy to Avoid Interview Pitfalls
Deepin Linux
Deepin Linux
Nov 30, 2025 · Fundamentals

When Does C++ Generate a Default Copy Constructor? A Deep Dive

This article explains the role of copy constructors in C++, when the compiler automatically provides a default one, the situations that trigger copy construction, why bitwise copying can be unsafe, and how to implement proper deep‑copy semantics with clear code examples.

C++Default ConstructorShallow Copy
0 likes · 31 min read
When Does C++ Generate a Default Copy Constructor? A Deep Dive
Deepin Linux
Deepin Linux
Aug 22, 2025 · Fundamentals

When Does C++ Generate a Default Copy Constructor? Deep Dive and Pitfalls

This article explains what a copy constructor is, when the C++ compiler automatically generates a default copy constructor, and why relying on shallow copying can cause serious bugs, especially with inheritance, virtual functions, and resource‑managing members.

C++Default ConstructorShallow Copy
0 likes · 39 min read
When Does C++ Generate a Default Copy Constructor? Deep Dive and Pitfalls
Liangxu Linux
Liangxu Linux
Nov 2, 2024 · Fundamentals

When Does Shallow Copy Break? Mastering Deep vs Shallow Copy in C++

This article explains the difference between shallow and deep copying in C++, shows why the default copy constructor can cause double‑deletion when a class holds pointers, and demonstrates how to implement a proper deep‑copy constructor with clear code examples.

C++Shallow Copycopy constructor
0 likes · 5 min read
When Does Shallow Copy Break? Mastering Deep vs Shallow Copy in C++