Skip to content

Commit 54ad935

Browse files
committed
see changkun#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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 8 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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>

0 commit comments

Comments
 (0)