When does a C++ temporary object die?(暂未翻译)
A lot of operations of C++ require temporary values. Using them before their destruction is imperative. However, not all C++ programmers I met have a solid understanding of when a temporary expire…
A lot of operations of C++ require temporary values. Using them before their destruction is imperative. However, not all C++ programmers I met have a solid understanding of when a temporary expire…
C++11引入了lambda表达式,而之后的语言版本不断的对lambda表达式进行改善。lambda表达式表示一个匿名函数。如今,lambda表达式已成为C++语言的核心组成部分,而这篇博文就是给还不了解lambda表达式的C++程序员讲解它的使用方法以及原理。 基本用法 编程中一个常见的任务是将函数作为参数传递给另外的函数。举一个例子,C…
Functional Programming in C++ by Ivan Čukić is a new book about applying functional programming principles in C++. This book is for people who already have a decent understanding of C++. It is…
尾递归 (tail recursion) 是函数式编程中的重要概念。在这篇文章中,我会用类似于 Elm 语言的伪码来解释尾递归。当然,你并不需要懂得任何的Elm来看懂这篇文章。 从递归到尾递归 考虑以下由递归实现的阶乘函数: 我们可以对 factorial(4) 进行展开: 我们在进行了函数调用之后再进行了乘法,所以我们需要一个地方储存数字4、3、2、1。这些数字被存在 栈帧(Stack…
CMake is the de facto industry standard for the build system generator of the C and C++ this days. Like C++, people seem to love and hate it at the same time. However, it is definitely a better…