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
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
#include "foo.h"

View File

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

View File

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

View File

@@ -5,6 +5,7 @@
// modern cpp tutorial
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
#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))
%.out: %.cpp Makefile
clang++ $< -o $@ -std=c++2a -Xclang -fconcepts-ts -pedantic
clang++ $< -o $@ -std=c++2a -pedantic
clean:
rm *.out

View File

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

View File

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

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
#include <iostream>
@@ -13,13 +14,12 @@
int main() {
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);
if (itr != vec.end()) {
*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);
itr != vec.end()) {
*itr = 4;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,6 +4,7 @@
// modern cpp tutorial
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
#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))
%.out: %.cpp Makefile

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,6 +3,7 @@
// modern c++ tutorial
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
// 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))
%.out: %.cpp Makefile