AITeky Learn

AiTeky Original Interactive Learning & Practice Intermediate

C++: scope-bound cleanup, copies and moves, and cache-friendly data

See how tying a resource to a variable's lifetime makes cleanup automatic on every path, how needless copies of big objects cost real time and how moving avoids them, and why the layout of data in memory can matter more than the algorithm.

C++ is C with powerful tools for building safe abstractions without losing speed. Three ideas carry most of modern C++: RAII (a resource's lifetime is tied to a variable, so cleanup is automatic), value semantics with moves (objects are copied or moved on purpose, and you can see the cost), and data layout (how the data sits in memory decides how fast it can be read).

This course models those ideas with small Python programs you can run in your browser. Python stands in for C++: the code is not C++, but the counts and the ordering it shows are what the real language does. Check a C++ reference for exact syntax and for the standard of your compiler. All numbers are made up.

  • Learn lessons explain one idea at a time and let you run it.
  • Industry ready lessons decide and justify, and end with interview questions.

No C++ experience is assumed. Basic Python helps.

Locked. Sign up free

Learn

Understand each idea with everyday examples. No coding background needed.

  1. 00 25 min 🔒 AiTeky Pass Start here: memory, addresses and pointers Picture memory as a long row of numbered boxes, see what an address and a pointer really are, and learn why a program that follows a stale address reads the wrong thing.
  2. 01 30 min Free sample 🔒 AiTeky Pass Cleanup that cannot be forgotten Model objects whose cleanup runs automatically when they go out of scope, in the reverse order of creation, on every path including errors, and compare that with cleanup that depends on the programmer remembering to do it.
  3. 02 30 min 🔒 AiTeky Pass Copies, moves and references Count the element copies that happen when a large object is passed by value, passed by reference, returned from a function, moved, or stored in a growing list, to see why needless copies cost real time and how references, moves and reserved space remove them.

Industry ready

Real problems from real jobs, and the questions interviewers ask about them.

  1. 03 35 min 🔒 AiTeky Pass On the job: making a loop fast by fixing the layout A simulation loop that sums one field of a million objects is far slower than the arithmetic suggests. Model a memory cache, count the misses for an array of structures and for a structure of arrays, compare four fixes by speed-up, effort and risk, choose, and write the performance note.

We use essential cookies to run the site. With your permission we also set one anonymous ID to count unique visitors, and analytics cookies to see which pages help learners. Cookie notice

Join AiTeky Learn. It's free.

Create a free account to track your progress, save items for later and get study suggestions.

Sign up free Log in