This bootcamp aims to provide a basic introduction to coding in modern C++. The features of the C++ language are too vast and expansive to cover in one bootcamp, and quite frankly, it is learned best through experience. The staff is certain that 15-445 will make you a more confident C++ programmer! However, we do cover some C++ topics that are necessary to know while doing the programming assignments. This tutorial does not cover basic C/C++ syntax. It mainly covers C++ programming features, particularly concepts that do not exist in C.
Feedback for the C++ bootcamp is always appreciated! Feel free to submit issues/PRs.
The bootcamp consists of C++ code files, located in src/
, that are meant
to be read in depth. Each of these files can be compiled into an executable
with the same name. Use CMake to build these executables. This set of commands
should build all the executables. After running these commands, these executables
should be located in the build
directory.
mkdir build
cd build
cmake ..
make -j8
For instance, the src/references.cpp
file compiles into the references
executable, located in ./build
. The same holds for every file in the source
directory.
There are fifteen files in the src/
directory, each which cover different
concepts. They are meant to be read in the order below, since each file
builds up on the previous one. However, if you know some modern C++ concepts
and are looking to refresh your knowledge, it is probably okay to start by
reading the files on concepts you are unfamiliar about.
references.cpp
: Covers C++ references.move_semantics.cpp
: Covers C++ move semantics.move_constructors.cpp
: Covers C++ class move constructors and move assignment operators.
templated_functions.cpp
: Covers C++ templated functions.templated_classes.cpp
Covers C++ templated classes.
wrapper_class.cpp
: Covers C++ wrapper classes.iterator.cpp
: Covers implementing a basic C++ style iterator.namespaces.cpp
: Covers C++ namespaces.
vectors.cpp
: Coversstd::vector
.set.cpp
: Coversstd::set
.unordered_map.cpp
: Coversstd::unordered_map
.auto.cpp
: Covers the usage of the C++ keywordauto
, including usingauto
to iterate through C++ STL containers.
unique_ptr.cpp
: Coversstd::unique_ptr
.shared_ptr.cpp
: Coversstd::shared_ptr
.
mutex.cpp
: Coversstd::mutex
.scoped_lock.cpp
: Coversstd::scoped_lock
.condition_variable.cpp
: Coversstd::condition_variable
.rwlock.cpp
: Covers the usage of several C++ STL synchronization primitive libraries (std::shared_mutex
,std::shared_lock
,std::unique_lock
) to create a reader-writer's lock implementation.
There are many other resources that will be helpful while you get accquainted to C++. I list a few here!
- https://en.cppreference.com/w/: Unofficial but quite accurate summary and examples of both C++ and C standards.
- https://cplusplus.com/: Contains both a C++ language tutorial and a C++ library reference.
- Modern C++ Tutorial. This GitHub repo contains some information and exercises that are useful!
This documentation may be useful to you! It's very comprehensive (much more comprehensive than this bootcamp) but it may lack some readability. Overall, I think it's still a good idea to try to read and understand this documentation, especially when working on the projects. Although the bootcamp tries to be as comprehensive as possible, it still only covers the bare bones of using modern C++.
- References
- std::move
- Move Constructors and Move Assignment Operators
- Templated Functions
- Templated Classes
- Iterators
- Namespaces
- std::vector
- std::set
- std::unordered_map
- auto
- std::unique_ptr
- std::shared_ptr
- std::mutex
- std::scoped_lock
- std::condition_variable
- std::shared_mutex
- std::shared_lock
- std::unique_lock