see #2: code updates

This commit is contained in:
Changkun Ou
2019-07-16 09:26:31 +02:00
parent 1068cefb1f
commit 54ad935875
41 changed files with 61 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include "foo.h" #include "foo.h"

View File

@@ -5,6 +5,7 @@
# modern cpp tutorial # modern cpp tutorial
# #
# created by changkun at changkun.de # created by changkun at changkun.de
# https://github.com/changkun/modern-cpp-tutorial
# #
C = gcc C = gcc

View File

@@ -5,6 +5,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include "foo.h" #include "foo.h"

View File

@@ -5,6 +5,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,7 +1,14 @@
#
# modern cpp tutorial
#
# created by changkun at changkun.de
# https://github.com/changkun/modern-cpp-tutorial
#
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp)) all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))
%.out: %.cpp Makefile %.out: %.cpp Makefile
clang++ $< -o $@ -std=c++2a -Xclang -fconcepts-ts -pedantic clang++ $< -o $@ -std=c++2a -pedantic
clean: clean:
rm *.out rm *.out

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>
@@ -13,13 +14,12 @@
int main() { int main() {
std::vector<int> vec = {1, 2, 3, 4}; std::vector<int> vec = {1, 2, 3, 4};
// before c++17, can be simplefied by using `auto` // after c++17, can be simplefied by using `auto`
const std::vector<int>::iterator itr = std::find(vec.begin(), vec.end(), 2); const std::vector<int>::iterator itr = std::find(vec.begin(), vec.end(), 2);
if (itr != vec.end()) { if (itr != vec.end()) {
*itr = 3; *itr = 3;
} }
// after c++17, can be simplefied by using `auto`
if (const std::vector<int>::iterator itr = std::find(vec.begin(), vec.end(), 3); if (const std::vector<int>::iterator itr = std::find(vec.begin(), vec.end(), 3);
itr != vec.end()) { itr != vec.end()) {
*itr = 4; *itr = 4;

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <initializer_list> #include <initializer_list>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
template<int i> template<int i>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -1,3 +1,10 @@
#
# modern cpp tutorial
#
# created by changkun at changkun.de
# https://github.com/changkun/modern-cpp-tutorial
#
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp)) all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))
%.out: %.cpp Makefile %.out: %.cpp Makefile

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 面向对象增强 // 面向对象增强

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 强类型枚举 // 强类型枚举

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// lambda expression // lambda expression

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// std::function std::bind // std::function std::bind

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 右值引用 rvalue reference // 右值引用 rvalue reference

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 移动语义 // 移动语义

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 移动语义 // 移动语义

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 完美转发 // 完美转发

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// std::array // std::array

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 无序容器 // 无序容器

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// std::tuple 及其操作 // std::tuple 及其操作

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 线程支持库 // 线程支持库

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// 生产者消费者模型 // 生产者消费者模型

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// noexcept // noexcept

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial // modern c++ tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
// literals // literals

View File

@@ -1,3 +1,10 @@
#
# modern cpp tutorial
#
# created by changkun at changkun.de
# https://github.com/changkun/modern-cpp-tutorial
#
all: $(patsubst %.cpp, %.out, $(wildcard *.cpp)) all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))
%.out: %.cpp Makefile %.out: %.cpp Makefile

View File

@@ -5,6 +5,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>

View File

@@ -5,6 +5,7 @@
// modern cpp tutorial // modern cpp tutorial
// //
// created by changkun at changkun.de // created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
// //
#include <iostream> #include <iostream>