advanced

C++11 threads, affinity and hyperthreading -- Eli Bendersky

How to use C++11 threads library for setting various attributes related to thread affinity/hyper-threading.

C++11 threads, affinity and hyperthreading

by Eli Bendersky

From the article:

This post is not a tutorial on C++11 threads, but it uses them as the main threading mechanism to demonstrate its points. It starts with a basic example but then quickly veers off into the specialized area of thread affinities, hardware topologies and performance implications of hyperthreading. It does as much as feasible in portable C++, clearly marking the deviations into platform-specific calls for the really specialized stuff.

A flexible lexicographical comparator for C++ structs--Björn Fahller

An interesting article:

A flexible lexicographical comparator for C++ structs

by Björn Fahller

From the article:

We've all hand crafted comparison operators for structs with many members, and we've all cursed the tedium. It's all right for equality comparison, but lexicographical ordering relations is a different story when there are more than two members.

Hopefully all C++ developers have by now learned about the std::tie()-idiom.

struct S
{
  int a;
  int b;
  int c;
};

bool operator<(const S& lh, const S& rh)
{
  return std::tie(lh.a, lh.b, lh.c)
       < std::tie(rh.a, rh.b, rh.c);
}

Both keynotes from Meeting C++ 2015 are now online!

See Chandler Carruth and Lars Knoll giving the keynotes at Meeting C++ this year:

Both Keynotes from Meeting C++ 2015 are online!

by Jens Weller

From the article:

Great news: Since yesterday, both of the keynotes from this years Meeting C++ conference are on youtube! Both keynote speakers chose to speak on a specific topic, and delivered very well. There is also a playlist for Meeting C++ 2015.

Overload 130 is now available

ACCU’s Overload journal of December 2015 is out. It contains the following C++ related articles.

Overload 130 / PDF

From the journal

Type Mosaicing with Consultables and Delegates

If several classes need to work together lots of boilerplate code is often needed. Nicolas Bouillot introduces type mosaicing to avoid this.

The Universality and Expressiveness of std::accumulate

Folding is a highly generic operation available through std::accumulate. Paul Keir goes beyond reduction, with the help of C++14’s polymorphic lambdas.
QM Bites – The two sides of Boolean Parameters
Boolean parameters are tempting but make life difficult. Matthew Wilson advises us to avoid them (almost) all the time.
Identify your Errors better with char[]
Error codes still get used instead of exceptions. Patrick Martin and Dietmar Kühl consider how to use char arrays for better information.
CPU Clocks and Clock Interrupts, and Their Effects on Schedulers
Instructions to sleep for a second almost never result in precisely one second’s sleep. Bob Schmidt walks us through the mechanics of why.