Skip to content

Instantly share code, notes, and snippets.

@ForgottenUmbrella
ForgottenUmbrella / ptr-ref-val.md
Created Dec 9, 2018
Notes on when to use pointers, references and values for variables, parameters and return values in C++.
View ptr-ref-val.md

When to use pointers, references and values

Variables (including member variables)

  • Prefer const.
  • Prefer stack allocations (i.e. values rather than pointers or references).
  • When heap allocation is necessary (e.g for polymorphism), prefer smart pointers to automatically handle lifespan and ownership.
    • Use std::unique_ptr for objects that should live until the end of scope.
    • Use std::shared_ptr for reference counting.
    • Use std::weak_ptr to safely access potentially deleted objects managed by
@ForgottenUmbrella
ForgottenUmbrella / using_conan_cpp.md
Created Apr 4, 2018
How to use Conan, a C++ package manager, for beginners
View using_conan_cpp.md

Package Management in C++ with Conan for Beginners

C++ package management can be complicated.

Below are some key tools involved:

Make

Make runs commands defined in a Makefile, for example, to build and install programs with the compiler and linker. For our purposes, we won't worry about what this looks like; you only need to understand its purpose in relation to CMake.

@ForgottenUmbrella
ForgottenUmbrella / publish_python.md
Last active Jan 20, 2022
How to publish Python apps for human beings
View publish_python.md

How to publish Python apps for human beings

So, you've created a Python app (be it a graphical user interface with Qt or the like, or a simple command line interface). Great! But how are others going to use it? Python applications often have dependencies (e.g. from third-party modules), and they also need a Python interpreter to run them. For a developer, installing all the necessary bits and bobs to make things work is okay, but that's unacceptable for a normal user - they just want to download the thing and run it.

Below are simple instructions to publish your app on the three main operating systems: Windows, macOS and Linux.