Articles & Books

CppCon 2016: The Blaze High Performance Math Library--Klaus Iglberger

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

The Blaze High Performance Math Library

by Klaus Iglberger

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

In this presentation we introduce the Blaze C++ math library, a hot contender for the linear algebra performance throne. Blaze is an open-source, high-performance library for dense and sparse arithmetic. It combines elegance and ease of use with HPC-grade performance, making it one of the most intuitive and at the same time fastest C++ math libraries available.

We demonstrate its basic linear algebra functionality by means of several BLAS level 1 to 3 operations and explain why Blaze outperforms even well established linear algebra libraries. Additionally, we present some advanced features that enable users to adapt Blaze to special circumstances: custom data structures, custom operations, and the customizable error reporting mechanism.

(Not Really So) New Niche for C++: Browser!? -- No Bugs Hare

In this article "No Bugs" Hare outlines the possibility to run C++ code in the major four web browsers.

(Not Really So) New Niche for C++: Browser!?

by "No Bugs" Hare

From the article:

For quite a long while, C++ had been losing popularity; for example, as reported in [Widman16], in 2016 it got 7% less of the listings on Dice.com compared with a year earlier; and according to [TIOBE17], from the C++ Golden Age in 2004 till 2017, the C++ share fell from ~17% to a measly 6%.

As all of us (as in, ‘hardcore C++ fans’) know , this has nothing to do with the deficiencies of C++; rather it is related to an observation that the time of downloadable clients (which was one of the main C++ strongholds) has changed into the time of browser-based clients – and all the attempts to get C++ onto browsers were sooo ugly (ActiveX, anyone?) that this didn’t really leave a chance to use C++ there.

Well, it seems that this tendency is already in the process of being reverted:

C++ can already run on all four major browsers – and moreover, it has several all-important advantages over JavaScript, too.
And this – not too surprisingly – is what this article is all about.

C++17: Structured Bindings--Marc Gregoire

It is coming!

C++17: Structured Bindings

by Marc Gregoire

From the article:

This is a first post in a series of short articles on new C++17 features. These articles will not contain all little details of the new features being presented, but they give you an idea about what new functionality has been added to C++17.

C++17 in details: Code Simplification--Bartlomiej Filipek

The series continue.

C++17 in details: Code Simplification

by Bartlomiej Filipek

From the article:

You might say that most of the new language features (not to mention The Standard Library improvements) are there to write simpler/cleaner code. The “C++17 in details” series reviews most of the bigger things, still for today, I tried to pick a few features that out of the box make your code more compact.

  • Structured bindings/Decomposition declarations
  • Init-statement for if/switch
  • Inline variables
  • constexpr if (again!)
  • a few other mentions

Quick Q: How to require an exact function signature in the detection idiom?

Quick A: Use is_detected

Recently on SO:

How to require an exact function signature in the detection idiom?

With C++17 is_detected, you may do

template <typename T, typename Ret, typename Index>
using subscript_t = std::integral_constant<Ret (T::*) (Index), & T::operator[]>;

template <typename T, typename Ret, typename Index>
using has_subscript = is_detected<subscript_t, T, Ret, Index>;

static_assert(has_subscript<std::vector<int>, int&, std::size_t>::value, "!");
static_assert(!has_subscript<std::vector<int>, int&, int>::value, "!");

Metaclasses: Thoughts on generative C++ -- Herb Sutter

The ACCU 2017 keynote video is now online, with context and updates from this month's standards meeting:

Metaclasses: Thoughts on generative C++

by Herb Sutter

From the article:

I’ve been working on an experimental new C++ language feature tentatively called “metaclasses” that aims to make C++ programming both more powerful and simpler. You can find out about it here...

C++17 attributes - maybe_unused, fallthrough and nodiscard--Simon Brand

Do you know these new attributes?

C++17 attributes - maybe_unused, fallthrough and nodiscard

by Simon Brand

From the article:

C++17 adds three new attributes for programmers to better express their intent to the compiler and readers of the code: maybe_unused, fallthrough, and nodiscard. This is a quick post to outline what they do and why they are useful.

Quick Q: Why is the count of weak_ptr tracked also?

Quick A: To be able to know when to delete the control block.

Recently on SO:

Why shared_ptr's reference counting object needs to keep track of the number of weak_ptrs pointing to the object too?

std::weak_ptr refers to the control block to know if the object still exists and if so, to provide a std::shared_ptr to it when needed. For that reason, the control block must exist as long as either a std::weak_ptr or a std::shared_ptr exists. You need to track the number of instances of std::weak_ptr to know when the last one is destroyed, just like for std::shared_ptr.