Articles & Books

Three reasons to pass std::string_view by value--Arthur O’Dwyer

You should.

Three reasons to pass std::string_view by value

by Arthur O’Dwyer

From the article:

It is idiomatic to pass std::string_view by value. Let’s see why.

First, a little background recap. In C++, everything defaults to pass-by-value; when you say Widget w you actually get a whole new Widget object. But copying big things can be expensive. So we introduce “pass-by-const-reference” as an optimization of “pass-by-value,” and we tell people to pass big and/or expensive things like std::string by const reference instead of by value.

But for small cheap things — int, char*, std::pair<int, int>, std::span<Widget> — we continue to prefer the sensible default behavior of pass-by-value.

Pass-by-value has at least three performance benefits over pass-by-(const)-reference. I’ll illustrate all three of them via string_view...

Strong Types for Safe Indexing in Collections – Part 2--Jonathan Boccara

Are you interested?

Strong Types for Safe Indexing in Collections – Part 2

by Jonathan Boccara

From the article:

In the previous article on strong types, we set out to find how to use strong types for safe indexing in collections.

More precisely, if we have two vectors with two indices to access them, how can we use strong types to make sure we use the right index for the right vector, and that we don’t swap them by mistake?

A capturing lambda can be a coroutine, but you have to save your captures while you still can

Will you use one?

A capturing lambda can be a coroutine, but you have to save your captures while you still can

by Raymond Chen

From the article:

We saw some time ago that capturing lambdas which are coroutines result in lifetime issues because the lambda itself returns at the first suspension point, at which point there’s a good chance it will be destructed. After that point, any attempt by the lambda body to access those captured variables is a use-after-free bug...

C++ String Benchmark -- Giovanni Dicanio

This small article compares different string implementations on the Windows platform.

C++ String Benchmark: STL vs. ATL vs. Custom Pool Allocator

by Giovanni Dicanio

From the article:

I was curious to compare the performance of the STL string implementation versus ATL CString, using Visual Studio 2019, so I wrote some simple C++ benchmark code for this purpose. I also added into the mix a custom string pool allocator.

 

Template Metaprogramming - How it All Started--Rainer Grimm

The series continue.

Template Metaprogramming - How it All Started

by Rainer Grimm

From the article:

Metaprogramming is programming on programs. C++ applies metaprogramming at compile time. It started in C++98 with template metaprogramming, was formalized in C++11 with the type-traits library, and since C++11 has steadily improved. The main driving force is constant expressions. In this post, I want to write about its roots...

Tripreport: virtual CppCon 2021--Jens Weller

Another report!

Tripreport: virtual CppCon 2021

by Jens Weller

From the article:

I attended this weeks virtual CppCon partially, as I'm also very busy with my upcoming conferences: Meeting Embedded & Meeting C++ 2021. Still I had a lot of fun. Thanks to Jon Kalb, the volunteers, speakers and all the attendees who made CppCon 2021 possible!

Looking for Employers for the online C++ job fair

Meeting C++ is looking for C++ employers to join the next online C++ job fair in mid November.

Looking for Employers for the online C++ job fair

by Jens Weller

From the article:

The Meeting C++ online job fair is in two weeks, and so far I only have one company interested in a free table as of today.

The job fair is on November 16th (afternoon CET) and 17th (evening CET). Sponsors will also be listed on the website with logo in the job section and at the job fair page. During the event your table will be above the free tables and you'll receive CVs through the tooling of Meeting C++ from the moment of signup to friday after the week of the event. The last job fair had 82 folks from 26 countries submit. These sponsorships are also what allows me to work on the tooling and improve the process further,  some funding of the sponsorships also goes into advertising of the event.

CppCon 2021 Virtual Trip Report, A User Story--Javier Estrada

Did you attend?

CppCon 2021 Virtual Trip Report, A User Story

by Javier Estrada

From the article:

This is the first CppCon hybrid (in person and virtual) conference, and in my opinion, it was a success in terms of content and organization, particularly from the virtual side. Sure, there were the occasional quirks, or the first day emergencies if one didn’t read the “instruction manual” (ahem) beforehand. But ’nuff said.

I’m writing this trip report while the experience is fresh, and before the glitter fades, drinking a hot cup of coffee while everybody else sleeps...