Tag: c++

Values, Pointers and References in C++

If you've primarily used high level languages like Python, you may not be used to explicitly thinking about the ownership or representation of your values in memory.1 In system languages like C++ or Rust, we have direct control over these aspects, and are able to use the type system to explicitly represent when a function takes ownership of a value, vs when it only takes a (temporary) reference.2

First, different types of ownership, in order of preference:

  • T t. A normal owned value of type T, uniqlue owned. If declared as a variable it is stored on the …

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .