Skip to content

Update slides, add compiler explorer links to .cpp files #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 01_values/01_01_basic_values.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/cfqo6YK7K
#include <iostream>

void f_int(int i) {
Expand Down
2 changes: 1 addition & 1 deletion 01_values/01_02_basic_references.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/sGeWevjcv
#include <iostream>

// we read "int&" as "integer reference"
Expand Down
2 changes: 1 addition & 1 deletion 01_values/01_03_lifecycle_creation_destruction.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/eb5qK3KxE
#include <iostream>

// a "struct" is just like a class, except for default visibility being "public"
Expand Down
2 changes: 1 addition & 1 deletion 01_values/01_04_lifecycle_copy_construction.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/o4MEPEjY1
#include <iostream>

struct C {
Expand Down
1 change: 1 addition & 0 deletions 01_values/01_05_lifecycle_raii.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/zGsrxG91Y
#include <iostream>
#include <fstream>

Expand Down
2 changes: 1 addition & 1 deletion 01_values/01_06_advanced_string.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/9bYz4oP3z
#include <stdlib.h>
#include <string.h>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion 01_values/01_07_advanced_string_move.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/qKef3jdWq
#include <stdlib.h>
#include <string.h>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion 02_classes_and_interfaces/02_01_basic_interfaces.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/TGqsGba5x
// Some examples are taken (or minimally adapted) from the C++ Core Guidelines

#include <cmath>
Expand Down
1 change: 1 addition & 0 deletions 02_classes_and_interfaces/02_04_return_smart_pointers.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/W7T7dKnoe
#include <iostream>
#include <memory>

Expand Down
1 change: 1 addition & 0 deletions 02_classes_and_interfaces/02_07_virtual_inheritance.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/c9EvnWffo
#include <iostream>

class A {
Expand Down
1 change: 1 addition & 0 deletions 02_classes_and_interfaces/02_08_private_inheritance.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/sWzYq9Mnj
#include <vector>
#include <iostream>

Expand Down
1 change: 1 addition & 0 deletions 02_classes_and_interfaces/02_09_operator_overloading.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/ns1xecTfb
#include <iostream>
#include <iomanip>

Expand Down
1 change: 1 addition & 0 deletions 02_classes_and_interfaces/02_10_friends.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/KeThK93ox
#include <string>
#include <iostream>

Expand Down
1 change: 1 addition & 0 deletions 02_classes_and_interfaces/02_11_hidden_friends.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/YEcffEEzo
#include <string>
#include <iostream>

Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_01_containers_sequence.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/KhT8er4Wr
#include <array>
#include <vector>
#include <deque>
Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_02_containers_associative.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/q19so8Ya9
#include <set>
#include <map>

Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_03_containers_unordered.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/bWY3jMqn8
#include <unordered_set>

#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_04_iterators.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/55rEh1avj
#include <vector>
#include <map>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_05_lambda_basics.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/h8xMTYjj1
#include <vector>
#include <functional>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_07_lambda_implementation.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/eWhKPhPPG
#include <iostream>

void test1() {
Expand Down
1 change: 1 addition & 0 deletions 03_lambdas_and_algorithms/03_08_alg_examples.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/ssKxxnb7q
#include <iostream>
#include <vector>
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion 03_lambdas_and_algorithms/03_09_exec_policy_bench.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// g++ main.cpp -O3 -std=c++20 -ltbb -Wall -Wextra -o main

// https://godbolt.org/z/xfPWd8orh
#include <algorithm>
#include <iomanip>
#include <numeric>
Expand Down
2 changes: 1 addition & 1 deletion 04_templates/04_01_function_templates_basic.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/6M7sfK3jT
#if true

int abs(int x) {
Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_02_template_parameter_categories.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/Wzx9GnzoT
#include <array>
#include <iostream>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_03_template_parameter_packs.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/brz64acKa
#include <unordered_set>

#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_04_template_arguments.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/Gxn7Y7Tes
#include <iostream>
#include <vector>
#include <list>
Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_05_class_template_basics.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/WE1YqvP7j
#include <initializer_list>
#include <algorithm>

Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_06_template_specialization.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/Yox7Y53We
#include <initializer_list>
#include <algorithm>

Expand Down
2 changes: 1 addition & 1 deletion 04_templates/04_07_class_template_arg_deduction.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// you can see this example working with recent GCC and Clang versions here:
// https://godbolt.org/z/WzFsJp
// https://godbolt.org/z/xvnxjcnK9

#include <algorithm>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion 04_templates/04_08_variable_templates.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/8PKz1bnYr
// variable template for pi

template<class T>
Expand Down
2 changes: 2 additions & 0 deletions 04_templates/04_09_alias_templates.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// https://godbolt.org/z/PKTGr39Gh
#include <algorithm>
#include <initializer_list>

template<typename ScalarType, int Length>
Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_10_two_phase_lookup.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/PM8edoq9f
#include <iostream>

/// Non-dependent name
Expand Down
1 change: 1 addition & 0 deletions 04_templates/04_11_parsing_hints.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/fM678oGcf
#include <iostream>

/// Dependent name
Expand Down
2 changes: 1 addition & 1 deletion 05_keyword_safari/05_01_storage_classes.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/xPhrhdYs9

int global1;
// global1: static storage duration, external linkage
Expand Down
1 change: 1 addition & 0 deletions 05_keyword_safari/05_02_static_initialization.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/csjnTxjcT
#include <iostream>

struct Trace {
Expand Down
1 change: 1 addition & 0 deletions 05_keyword_safari/05_03_cv_qualification.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/b3vzz9rdd

void take_int_ref(int& i) {}

Expand Down
2 changes: 1 addition & 1 deletion 05_keyword_safari/05_04_static_members.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/bsTfzEzan
#include <iostream>

struct Foo {
Expand Down
1 change: 1 addition & 0 deletions 05_keyword_safari/05_05_explicit_constructors.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/hnhxejcfE
#include <iostream>

struct Point {
Expand Down
2 changes: 1 addition & 1 deletion 05_keyword_safari/05_06_member_ref_qualifiers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/v757ca5oW
class Vector {
float contents[10];

Expand Down
3 changes: 1 addition & 2 deletions 05_keyword_safari/05_08_constexpr.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/oTaPxP6Ec
#include <iostream>

constexpr int fac(int n) {
Expand All @@ -16,4 +16,3 @@ int main() {
constN<fac(4)> out1;
}

// https://godbolt.org/g/XoaGL9
2 changes: 1 addition & 1 deletion 05_keyword_safari/05_09_constevalinit.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Sample adapted from cppreference
// Available in compiler explorer: https://godbolt.org/z/7YY3sb9YP
// https://godbolt.org/z/zKhYaf33q

#include <iostream>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/oaWPrb6e5
#include <iostream>
#include <climits>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_02_type_parameter.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/rj8avoKoz
#include <iostream>

template<typename T>
Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_03_type_result.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/PdP48h9ET
#include <type_traits>
#include <iostream>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_04_refactoring_conventions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/85b9Esxvn
#include <type_traits>
#include <iostream>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_05_tuple_includes.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/nhao6438h
#include <iostream>
#include <tuple>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_06_tuple_includes_prime.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/fnEPqs6jq
#include <iostream>
#include <tuple>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_07_dispatch.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/sdW5894xe
#include <iostream>

/// Scenario: /////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_08_decltype_declval.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/5cY9v39Y9
#include <iostream>
#include <string>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_09_sfinae.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/jr9cr9GPP
#include <iostream>
#include <string>

Expand Down
1 change: 1 addition & 0 deletions 06_advanced_templates/06_10_crtp.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/qEsshf7Yn
#include <iostream>

template <class T>
Expand Down
1 change: 1 addition & 0 deletions 07_concepts/07_01_basic_sample.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/To89f71M4
#include <concepts>
#include <cstddef>
#include <functional>
Expand Down
1 change: 1 addition & 0 deletions 07_concepts/07_02_syntax_options.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/GsE1rvqnT
#include <concepts>
#include <cstddef>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion 07_concepts/07_03_constrained_auto.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// note: this is currently not supported in MSVC 16.8
// https://godbolt.org/z/WPGscxPdo

#include <concepts>
#include <cstddef>
Expand Down
2 changes: 1 addition & 1 deletion 07_concepts/07_04_requires_expression.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// https://godbolt.org/z/WYEoW5bzz
// basic requires expression in a concept definition
template <typename T>
concept Addable = requires(T x) {
Expand Down
1 change: 1 addition & 0 deletions 07_concepts/07_05_requirements.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/75q59E7cv
#include <utility>
#include <concepts>

Expand Down
1 change: 1 addition & 0 deletions 07_concepts/07_06_dispatch.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/xdEssa3bP
#include <iostream>

/// Scenario: /////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion 07_concepts/07_07_partial_order.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/6c5r537e5
#include <iostream>

template<typename T>
Expand Down Expand Up @@ -52,4 +53,4 @@ void test3() {
int main() {
test1();
test2();
}
}
1 change: 1 addition & 0 deletions 08_libraries/08_01_regex.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/5TGhEzhn8
#include <iostream>
#include <string>
#include <regex>
Expand Down
1 change: 1 addition & 0 deletions 08_libraries/08_02_threads.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/81cd58Wxr
#include <iostream>
#include <string>
#include <thread>
Expand Down
1 change: 1 addition & 0 deletions 08_libraries/08_03_future_fs.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/5T7E4W45r
#include <iostream>
#include <string>
#include <future>
Expand Down
2 changes: 1 addition & 1 deletion 08_libraries/08_04_boost_format.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// adapted from boost::format example

// https://godbolt.org/z/3q169Eoa7
#include <iostream>
#include <iomanip>
#include <cassert>
Expand Down
2 changes: 1 addition & 1 deletion 08_libraries/08_05_boost_bimap.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// adapted from boost::bimap example

// https://godbolt.org/z/7Mor8P46z
#include <string>
#include <iostream>

Expand Down
1 change: 1 addition & 0 deletions 08_libraries/08_06_boost_operators.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/WGqhjGWd4
#include <string>
#include <iostream>
#include <cmath>
Expand Down
1 change: 1 addition & 0 deletions 08_libraries/08_07_boost_hana.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/erGf1bbx9
#include <iostream>

/// Scenario: /////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions 08_libraries/08_10_eigen.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// https://godbolt.org/z/erGf1bbx9
#include <iostream>

#include <Eigen/Dense>
Expand Down