Skip to content

Commit 54ad935

Browse files
committed
see #2: code updates
1 parent 1068cef commit 54ad935

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+61
-3
lines changed

code/1/1.1.c.and.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// modern cpp tutorial
66
//
77
// created by changkun at changkun.de
8+
// https://github.com/changkun/modern-cpp-tutorial
89
//
910

1011
#include "foo.h"

code/1/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# modern cpp tutorial
66
#
77
# created by changkun at changkun.de
8+
# https://github.com/changkun/modern-cpp-tutorial
89
#
910

1011
C = gcc

code/1/foo.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// modern cpp tutorial
66
//
77
// created by changkun at changkun.de
8+
// https://github.com/changkun/modern-cpp-tutorial
89
//
910

1011
#include "foo.h"

code/1/foo.h

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// modern cpp tutorial
66
//
77
// created by changkun at changkun.de
8+
// https://github.com/changkun/modern-cpp-tutorial
89
//
910

1011
#ifdef __cplusplus

code/10/Makefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
#
2+
# modern cpp tutorial
3+
#
4+
# created by changkun at changkun.de
5+
# https://github.com/changkun/modern-cpp-tutorial
6+
#
7+
18
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))
29

310
%.out: %.cpp Makefile
4-
clang++ $< -o $@ -std=c++2a -Xclang -fconcepts-ts -pedantic
11+
clang++ $< -o $@ -std=c++2a -pedantic
512

613
clean:
714
rm *.out

code/2/2.01.nullptr.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.02.constexpr.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.03.if.switch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>
@@ -13,13 +14,12 @@
1314
int main() {
1415
std::vector<int> vec = {1, 2, 3, 4};
1516

16-
// before c++17, can be simplefied by using `auto`
17+
// after c++17, can be simplefied by using `auto`
1718
const std::vector<int>::iterator itr = std::find(vec.begin(), vec.end(), 2);
1819
if (itr != vec.end()) {
1920
*itr = 3;
2021
}
2122

22-
// after c++17, can be simplefied by using `auto`
2323
if (const std::vector<int>::iterator itr = std::find(vec.begin(), vec.end(), 3);
2424
itr != vec.end()) {
2525
*itr = 4;

code/2/2.04.initializer.list.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.05.structured.binding.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.06.auto.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <initializer_list>

code/2/2.07.decltype.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.08.tail.return.type.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.09.decltype.auto.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
template<int i>

code/2/2.10.if.constexpr.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.11.for.loop.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.12.external.template.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.13.alias.template.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.14.default.template.param.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.15.variadic.template.param.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.16.fold.expression.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/2.18.non.type.template.auto.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// modern cpp tutorial
55
//
66
// created by changkun at changkun.de
7+
// https://github.com/changkun/modern-cpp-tutorial
78
//
89

910
#include <iostream>

code/2/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#
2+
# modern cpp tutorial
3+
#
4+
# created by changkun at changkun.de
5+
# https://github.com/changkun/modern-cpp-tutorial
6+
#
7+
18
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))
29

310
%.out: %.cpp Makefile

code/2/todo/2.7.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 面向对象增强
89

code/2/todo/2.8.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 强类型枚举
89

code/3/3.1.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// lambda expression
89

code/3/3.2.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// std::function std::bind
89

code/3/3.3.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 右值引用 rvalue reference
89

code/3/3.4.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 移动语义
89

code/3/3.5.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 移动语义
89

code/3/3.6.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 完美转发
89

code/4/4.1.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// std::array
89

code/4/4.2.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 无序容器
89

code/4/4.3.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// std::tuple 及其操作
89

code/7/7.1.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 线程支持库
89

code/7/7.2.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// 生产者消费者模型
89

code/9/9.1.noexcept.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// noexcept
89

code/9/9.2.literals.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// modern c++ tutorial
44
//
55
// created by changkun at changkun.de
6+
// https://github.com/changkun/modern-cpp-tutorial
67
//
78
// literals
89

code/9/Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#
2+
# modern cpp tutorial
3+
#
4+
# created by changkun at changkun.de
5+
# https://github.com/changkun/modern-cpp-tutorial
6+
#
7+
18
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))
29

310
%.out: %.cpp Makefile

exercises/2/fold.expresion.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// modern cpp tutorial
66
//
77
// created by changkun at changkun.de
8+
// https://github.com/changkun/modern-cpp-tutorial
89
//
910

1011
#include <iostream>

exercises/2/structured.binding.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// modern cpp tutorial
66
//
77
// created by changkun at changkun.de
8+
// https://github.com/changkun/modern-cpp-tutorial
89
//
910

1011
#include <iostream>

0 commit comments

Comments
 (0)