Articles & Books

New Concurrency Features in C++14 -- Anthony Williams

Anthony Williams describes shared locking in his recent blog post.

New Concurrency Features in C++14

by Anthony Williams

From the article:

It might have been out for 7 months already, but the C++14 standard is still pretty fresh. The changes include a couple of enhancements to the thread library, so I thought it was about time I wrote about them here.

The biggest of the changes is the addition of std::shared_timed_mutex. This is a multiple-reader, single-writer mutex. This means that in addition to the single-ownership mode supported by the other standard mutexes, you can also lock it in shared ownership mode, in which case multiple threads may hold a shared ownership lock at the same time.

This is commonly used for data structures that are read frequently but modified only rarely. When the data structure is stable, all threads that want to read the data structure are free to do so concurrently, but when the data structure is being modified then only the thread doing the modification is permitted to access the data structure.

 

Cache-friendly binary search--Joaquín M López Muñoz

An interesting approach to sorted search:

Cache-friendly binary search

by Joaquín M López Muñoz

From the article:

High-speed memory caches present in modern computer architectures favor data structures with good locality of reference, i.e. the property by which elements accessed in sequence are located in memory addresses close to each other. This is the rationale behind classes such as Boost.Container flat associative containers, that emulate the functionality of standard C++ node-based associative containers while storing the elements contiguously (and in order)...

Bitesize Modern C++: nullptr--Glennan Carnie

An article about the null value of a pointer:

Bitesize Modern C++: nullptr

by Glennan Carnie

From the article:

What’s the value of a null pointer?

  • 0
  • NULL
  • NUL

No doubt you’ve been involved in the (always heated) discussions about which is the correct one (By the way, if you said NUL you need to take yourself to one side and give yourself a stern talking to)...

Fun with Lambdas: C++14 Style (Part 4)—Sumant Tambe

More rapid-fire “now write this using lambdas” problem-solution drill with Sumant Tambe:

Fun with Lambdas: C++14 Style (Part 4)

by Sumant Tambe

From the article:

C++14 has a number of features that support functional-style design. By "functional-style" I mean heavy use of higher-order functions (functions that take other functions as arguments). Quite often arguments to the higher-order functions are lambdas (closures, to be precise). With automatic return type deduction for normal functions, writing higher-order function becomes very easy and seamless in C++14...

Set-up and tear-down--Andrzej Krzemieński

Today, you have an article about a specific aspect of unit-testing:

Set-up and tear-down

by Andrzej Krzemieński

From the article:

Recently as part of program run-time performance optimization effort, I was scanning through the code for occurrences of keyword new. The goal was to find unnecessary memory allocations. I was surprised to find most of news in the unit test module. Not that there was any particular need for memory allocation: it is just that the framework that was chosen (a fairly popular one) enforces on the programmers bad practices of manually controlling the life-time of their objects...

Trip Report: On Games(SG14) and TM(SG5) from The View at the May 2015 C++ Standard meeting in Lenexa

Another longtime committee member just posted his trip report for last month's meeting:

On Games(SG14) and TM(SG5) from The View at the May 2015 C++ Standard meeting in Lenexa

by Michael Wong

From the article:

The yellow brick road starts here in Kansas (actually Lenexa) hosted by Perceptive Software, and it is called C++17. At this meeting, it led with a major evening discussion on the philosophy of C++17 on a Monday night full session...

Handling short codes — part II---Andrzej Krzemieński

Second part of a discussion about designing a type storing character strings of length N (known at compile-time and sufficiently small).

Handling short codes - part II

by Andrzej Krzemieński

From the article:

Today, we will continue with the implementation of a type capable of storing short codes. For the previous post on the subject see here. This time, we will focus on type safety...

Bitesize Modern C++: enum class--Glennan Carnie

A simple and complete explanation of the enum:

Bitesize Modern C++: enum class

by Glennan Carnie

From the article:

Enumerated types in C++ give a trivial simulation of symbolic types – that is, objects whose instances have unique, human-readable values. In C++ enumerations are essentially named integers that are either assigned values implicitly by the compiler or explicitly by the programmer (or a combination of both)...

The State of C++ – Is it Back or Not? -- Arne Mertz

A personal opinion from Arne Mertz about the state of C++. Always interesting.

The State of C++ – Is it Back or Not?

By Arne Mertz

From the article:

The notion of C++ coming back to where it was before the raise of languages like Java and C#, or even the comparison of C++ now and then has a serious flaw: It is an isolated view of only the languages, competing for popularity in a fixed surrounding.