mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 04:34:40 +03:00
revision #1: 更新第二章中已维护的代码
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// 1.1.cpp
|
||||
//
|
||||
// chapter 1 introduction
|
||||
// c++1x tutorial
|
||||
// modern cpp tutorial
|
||||
//
|
||||
// created by changkun at changkun.de
|
||||
//
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <functional>
|
||||
|
||||
int main() {
|
||||
// 使用 lambda 表达式
|
||||
// use lambda expression
|
||||
[out = std::ref(std::cout << "Result from C code: " << add(1, 2))](){
|
||||
out.get() << ".\n";
|
||||
}();
|
||||
@@ -2,21 +2,21 @@
|
||||
# 1.1.cpp
|
||||
#
|
||||
# chapter 1 introduction
|
||||
# c++1x tutorial
|
||||
# modern cpp tutorial
|
||||
#
|
||||
# created by changkun at changkun.de
|
||||
#
|
||||
|
||||
C = gcc
|
||||
CXX = g++
|
||||
CXX = clang++
|
||||
|
||||
SOURCE_C = foo.c
|
||||
OBJECTS_C = foo.o
|
||||
|
||||
SOURCE_CXX = 1.1.cpp
|
||||
SOURCE_CXX = 1.1.c.and.cpp
|
||||
|
||||
TARGET = 1.1
|
||||
LDFLAGS_COMMON = -std=c++1z
|
||||
TARGET = 1.1.out
|
||||
LDFLAGS_COMMON = -std=c++17
|
||||
|
||||
all:
|
||||
$(C) -c $(SOURCE_C)
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// foo.c
|
||||
//
|
||||
// chapter 1 introduction
|
||||
// c++1x tutorial
|
||||
// modern cpp tutorial
|
||||
//
|
||||
// created by changkun at changkun.de
|
||||
//
|
||||
|
||||
#include "foo.h"
|
||||
|
||||
// C 语言代码
|
||||
// C code
|
||||
int add(int x, int y) {
|
||||
return x+y;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// foo.h
|
||||
//
|
||||
// chapter 1 introduction
|
||||
// c++1x tutorial
|
||||
// modern cpp tutorial
|
||||
//
|
||||
// created by changkun at changkun.de
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user