CPP

Configuring VSCode

IntelliSense Configurations

  1. Go to the desired directory
  2. View > Command Palette (Ctrl+Shift+P) > C++ Edit configuration UI
  3. Compiler path = g++ (for C++)
  4. C++ standard = 20
  5. Ctrl+S (To save)

Build task

  1. Open and select a cpp file
  2. Terminal > Configure Default Build Task
  3. In Task.json
    1. in "args" section add "-Wall", "-Wall", "-std=c++20",

Interesting Sources

Interesting opencv doc: Here

The Basics

References and pointers

If you want obvious "no-copy" semantics:

Use pointers (T*) when you want it explicit: “This function takes an address.”

Use references (T&) only when you want to guarantee it can’t be null and can’t change which object it refers to.

For large objects, you can use const T& to avoid copies while still signaling "read-only."