Articles & Books

Semaphores in C++20--Rainer Grimm

A new useful construct in the standard library.

Semaphores in C++20

by Rainer Grimm

From the article:

Semaphores are a synchronization mechanism used to control concurrent access to a shared resource. They also allow it to play ping-pong...

Build Throughput Series: Template Metaprogramming Fundamentals--Xiang Fan

Optimise templates.

Build Throughput Series: Template Metaprogramming Fundamentals

by Xiang Fan

From the article:

Template metaprogramming is popular and seen in many code bases. However, it often contributes to long compile times. When investigating build throughput improvement opportunities in large codebases, our finding is that more than one million template specializations and template instantiations is quite common and often provides optimization opportunities for significant improvement.

In this blog post, I will walk through the differences between template specialization and template instantiation and how they are processed in the MSVC compiler...

4 Features of Boost HOF That Will Make Your Code Simpler--Jonathan Boccara

Convinced?

4 Features of Boost HOF That Will Make Your Code Simpler

by Jonathan Boccara

From the article:

Boost HOF, standing for Higher Order Functions, is a Boost library offering functions that work on functions.

This impressive library provides a lot of advanced components allowing to go a step further into functional programming in C++. In this post, we’ll focus on 4 of the more basic ones (+ a bonus one) that allow to make code simpler in common tasks.

HOF provides one header in the form of #include <boost/hof/XXX.hpp> for each component, as well as a general header #include <boost/hof.hpp>. It is compatible with C++11...

Reusable HTTP(S) Connections--Richard Hodges

With boost.

Reusable HTTP(S) Connections

by Richard Hodges

From the article:

Something I am often asked by users of Boost Beast is how to code a client which effectively re-uses a pool of HTTP connections, in the same way a web browser does.

The premise is straightforward - if our client is going to be making multiple calls to a web server (or several of them) then it makes sense that once a connection has been used for one request, it is returned to a connection pool so that a subsequent request can make use of it...

GotW #97 Solution: Assertions -- Herb Sutter

tmp.PNGSolution just posted:

GotW #97 Solution: Assertions

by Herb Sutter

From the article:

Assertions have been a foundational tool for writing understandable computer code since we could write computer code... far older than C’s assert() macro, they go back to at least John von Neumann and Herman Goldstine (1947) and Alan Turing (1949). [1,2] How well do we understand them... exactly?

 

ACCU Overload 160 -- accu.org

The latest magazine of ACCU is online available or as paper copy for members.

by accu.org

From the index

Debt – My First Thirty Years.
Reflecting on code often reveals gnarliness. Frances Buontempo reminds herself about all the tech debt she’s ever caused.

Questions on the Form of Software.
Writing software can be difficult. Lucian Teodorescu considers whether these difficulties are rooted in the essence of development.

Building g++ From the GCC Modules Branch.
Using the WSL to build the g++ modules branch. Roger Orr demonstrates how to get a compiler that supports modules up and running.

Consuming the uk-covid19 API.
Covid-19 data is available in many places. Donald Hernik demonstrates how to wrangle data out of the UK API.

What is the Strict Aliasing Rule and Why Do We Care?
Type Punning, Undefined Behavior and Alignment, Oh My! Strict aliasing is explained.

Afterwood.
Design Patterns emerged last century. Chris Oldwood explains why he thinks they are still relevant.

C++ at the end of 2020--Bartlomiej Filipek

A summary of the year and the future.

C++ at the end of 2020

by Bartlomiej Filipek

From the article:

While 2020 was a crazy and hard year we were fortunate - C++20 was accepted and published, and the work on new features continues.

As usually every year, here’s my overview of the year: the standardization process, features, implementation, compilers, tools, books and more...

Firsts in 2020 (or, A little dose of good news)--Herb Sutter

A year full of accomplishments.

Firsts in 2020 (or, A little dose of good news)

by Herb Sutter

From the article:

2020 has been mostly terrible. That includes for the C++ committee and many of our communities, where just this month we lost Beman Dawes. Beman was one of the most important and influential C++ experts in the world, and made his many contributions mostly behind the scenes. I and everyone else who has ever benefited from any of the standardized STL, Boost, C++Now, std::filesystem, C++98/11/14/17, and more — so, really, most people who have ever used C++ — all owe Beman a debt of gratitude. We miss him greatly.

To end the year with a little dose of good news, I thought I’d mention a just few positive C++ accomplishments that did happen for 2020, and were happier “first-ever” achievements.

First, the big one…

One Trick with Private Names and Function Templates--Bartlomiej Filipek

Will you use it?

One Trick with Private Names and Function Templates

by Bartlomiej Filipek

From the article:

Last time in my blog post about How to Share Code with Const and Non-Const Functions in C++ I had a custom type declared and defined in one place (like in a header file). Recently, I tried to separate the declaration from implementation, and I got into a situation where one private function template was left.

In this article, I’d like to show you one trick that allowed me to convert this function template into a non-member function without giving up private details of the class...