Modern C++ In-Depth — Lambdas, Part 2
Lambdas
Modern C++ In-Depth — Lambdas, Part 2
by Michael Kristofik
From the article
In this installment, we’ll take a closer look at how to write and use lambdas, along with examining a common pitfall.
September 13-19, Aurora, CO, USA
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Jens Maurer | Jan 19, 2023 01:03 PM | Tags: None
Lambdas
Modern C++ In-Depth — Lambdas, Part 2
by Michael Kristofik
From the article
In this installment, we’ll take a closer look at how to write and use lambdas, along with examining a common pitfall.
By Blog Staff | Jan 13, 2023 10:59 AM | Tags: None
Are you a library person (std::function, std::bind, std::bind_front) or a language person (lambdas, auto, currying)? So many tools to get the job done...
Partial function application
by Rainer Grimm
From the article:
A few weeks ago, I had a discussion with a few of my readers. One reader said that I should write about Partial Function Applications. Another reader mentioned that C++ does not support function applications. This is wrong. C++ supports Partial Function Application. Consequently, I am writing today about
std::function
,std::bind
,std::bind_front
, lambdas,auto
, and currying.Let me start with a bit of theory...
By Blog Staff | Jan 13, 2023 10:57 AM | Tags: None
Perfectly imperfect:
Using perfect (and imperfect) forwarding to simplify C++ wrapper classes
by Raymond Chen
From the article:
There may be cases where you have a C++ class that wants to wrap another C++ class that is contained as a member. ... It’s annoying that there’s so much boilerplate to do the method forwarding, and that we have to keep looking up the parameters and return types so that each forwarder has the correct signature. Fortunately, we can use perfect forwarding to write most of them for us: ...
By Blog Staff | Jan 1, 2023 11:32 AM | Tags: None
Sending us straight into the new year with cash, cars, and games:
An interview that went viral
by Rainer Grimm
From the article:
I gave the interview for the e-finance-blog "efinancialcareers". I essentially stated the following:
- C++ is heavily used in the finance industry, for game developers, and in the automotive industry.
- When you want to learn C++, start at least with C++11.
- C++ is often used to build infrastructure.
- C++ is too big to fall.
... In total, I got almost 2000 comments. Today, I want to present the main points about the final interview, because this is my motivation for writing articles, posts, and books, recording videos, and teaching and mentoring C++...
By Blog Staff | Dec 24, 2022 10:21 AM | Tags: None
With detailed step by step instructions on how to make it work...
Using modules in the big three compilers: a small experiment
From the article:
The goal of my experiment was to see how easy it is to write code that a) uses C++20 modules, b) can be compiled by GCC, Clang and MSVC without using conditional compilation, c) imports something from the standard library, d) exports at least one templated function, e) has a peculiarity that makes the module harder to find (in my case, the module is named b but the file that contains it is named a.cppm).
The experiment sort of succeeded...
By Blog Staff | Dec 20, 2022 01:54 PM | Tags: None
A canonical example:
by Rainer Grimm
From the article:
Purpose: Defines a family of algorithms and encapsulates them in objects
Also known as: Policy
Use case:
By Blog Staff | Dec 19, 2022 01:53 PM | Tags: None
With or without actual templates:
by Rainer Grimm
From the article:
The key idea of the Template Method is easy to get. You define the skeleton of an algorithm that consists of a few typical steps. Implementation classes can only override the steps but cannot change the skeleton. The steps are often called hook methods...
By Blog Staff | Dec 17, 2022 02:59 PM | Tags: None
When profiling is a good thing:
C/C++ Profiling Tools
by David Faure
From the article:
This blog will give you a brief overview of profiling C and C++ applications. Additionally, it will lay before you all of the tools available, with the purpose of aiding you in choosing the right tools at the right times...
By Blog Staff | Dec 17, 2022 02:45 PM | Tags: None
Const... times four:
by Bartlomiej Filipek
From the article:
As of C++20, we have four keywords beginning with const. What do they all mean? Are they mostly the same? Let’s compare them in this article...
By Jens Maurer | Dec 6, 2022 06:08 AM | Tags: c++11 basics
Lambdas
Modern C++ In-Depth — Lambdas, Part 1
by Phani Adusumilli
From the article
While lambdas do not allow us to write anything we could not have written before their introduction, they greatly improve the ease with which we can write function objects and callbacks.