Skip to content

Instantly share code, notes, and snippets.

@alejandro-isaza
Last active May 4, 2017 03:06
Show Gist options
  • Save alejandro-isaza/71c6ae6717a4087eeff1 to your computer and use it in GitHub Desktop.
Save alejandro-isaza/71c6ae6717a4087eeff1 to your computer and use it in GitHub Desktop.
Introduction to Modern C++ Workshop

Abstract

C++ has a reputation of being an experts-only low-level programming language. But this is not the case anymore. C++11 and 14 introduce smart pointers, multi-threading, lambdas, move semantics, scoped enums, const expressions, user-defined literals, and a lot of other new features. The C++ standards committee is shortening the release cycle and modernizing the language.

This workshop is an introduction to new features and best practices of modern C++. We will delve into the core of C++ and all new features introduced in C++11 and C++14. There are two specific aims: to introduce you to C++ with emphasis on modern features and to help you make well-informed decisions when writing C++ code.

On completion of this workshop you should be able to:

  • Write C++ code using the latest language features while following the best practices
  • Identify modern C++ features and techniques
  • Use third-party libraries and frameworks

Prerequisites

  • Materials: Bring a laptop with a C++ compiler that supports at least C++11, preferably C++14 (Clang 3.4 (Xcode 6), VS 2015, GCC 4.9). Install boost and SFML (e.g. brew install boost sfml). Bring your favourite text editor or IDE.
  • Knowledge: Basic programming experience in a C-like language

About Alejandro @aleph7

Alejandro Isaza is a polyglot software developer. He has a M.Sc. in Computing Science from the University of Alberta and bachelor degrees in both computers and physics. He currently works for Venture Media Labs as lead mobile developer. He has been programming in C++ for more than 10 years, using it for a wide variety of applications including physics simulations, AI, low-level networking, games and music.

Syllabus

  • Part 1: Introduction (1hr)
    • C++98 vs. C++11 and the standards process
    • C++ language basics
      • Types, const, static
      • Classes, includes, forward declarations
      • Operator overloading
      • Namespaces
      • Templates
    • The standard library
      • Streams
      • Containers
      • Iterators
      • Algorithms
    • Useful thid-party libraries
      • Boost
      • UI (Cinder, SFML, Qt)
  • Part 2: Compilation (1hr)
    • Hello world
    • Compiling
    • Understanding errors
    • Warnings and other compiler flags
    • Including third-party libraries
  • Part 3: Writing a class (1hr)
    • public, protected and private
    • Constructors and initializer lists
    • Inheritance
    • virtual methods, final, override
    • RAII
    • Copy and move
  • Part 4: Unit tests (30min)
    • writing a boost test suite
    • check macros
    • measuring test coverage
  • Lunch break
  • Part 5: exceptions (30min)
    • throwing and exception
    • catching an exception
    • exception safety
    • noexcept
  • Part 6: Smart pointers (30min)
    • using unique pointers
    • using shared pointers
    • avoiding circular references: weak pointers
    • smart pointers for resource management
  • Part 7: lambdas (30min)
    • how to write a lambda
    • capture lists
    • alternatives to lambdas: function objects
  • Part 8: templates (1hr)
    • writing a generic function
    • writing a generic class
    • forwarding references
    • template meta-programming teaser
  • Part 9: concurrency (1hr)
    • atomic variables
    • mutexes
    • async tasks
    • threads
  • Part 10: Coding time
    • spend some time writing your own code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment