Introducing Abseil, a new common libraries project--Titus Winters

A new library is out!

Introducing Abseil, a new common libraries project

by Titus Winters

From the article:

Today we are open sourcing Abseil, a collection of libraries drawn from the most fundamental pieces of Google’s internal codebase. These libraries are the nuts-and-bolts that underpin almost everything that Google runs. Bits and pieces of these APIs are embedded in most of our open source projects, and now we have brought them together into one comprehensive project. Abseil encompasses the most basic building blocks of Google’s codebase: code that is production tested and will be fully maintained for years to come.

Bjarne Stroustrup awarded 2017 Faraday Medal

The Faraday Medal is awarded for conspicuous service rendered to the advancement of science, engineering and technology:

Bjarne Stroustrup awarded 2017 Faraday Medal

by Institution of Engineering and Technology

From the article:

“I am honored and humbled to see my name among so many illustrious previous winners of the prize,” said Stroustrup. “This privilege is only possible through the superb work of the C++ community.”

Static libs do not modular make -- Thomas Young

An article about static libraries, the benefits (or non-benefits) of splitting your project into static libraries, and the knock-on effects this can have on project dependencies.

Static libs do not modular make

by Thomas Young

From the article:

A cautionary tale about statically-linked libraries, as generated by C/C++ build tools.

As a project accumulates features, and complexity, it gets harder to understand exactly what's going on, and to find your way around the source code. You need to find some way to organise the code and try and keep things manageable.

A common idea, in this situation, is to group some source files together to split out as a static library.

I'm going to argue that this actually does very little, in itself, to increase modularity, can have the effect of significantly increasing dependencies, and is maybe not such a good idea, after all.

CppCast Episode 119: C# and IL2CPP with Josh Peterson

Episode 119 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Josh Peterson from Unity 3D to talk about C# and some of the similarities and differences between the Managed language and C++, he also talks about his work at Unity 3D on IL2CPP.

CppCast Episode 119: C# and IL2CPP with Josh Peterson

by Rob Irving and Jason Turner

About the interviewee:

Josh is a programmer working at Unity Technologies, where he focuses on integration and development of scripting runtimes for the Unity 3D game engine. He enjoys learning about CPU architectures and assembly language, including the recent development of an MOS 6510 emulator in C#. In his free time, he coaches a number of youth soccer teams and reads philosophy and theology.

Quick Q: What are template deduction guides in C++17?

Quick A: A solution for automatic template resolution on constructors.

Recently on SO:

What are template deduction guides in C++17?

Template deduction guides are patterns associated with a template class that tell the compiler how to translate a set of parameter (and their types) into template arguments.

The simplest example is that of std::vector and its constructor that takes an iterator pair.

template<typename Iterator>
void func(Iterator first, Iterator last)
{
  vector v(first, last);
}

The compiler needs to figure out what vector<T>'s T type will be. We know what the answer is; T should be typename std::iterator_traits<Iterator>::value_type. But how do we tell the compiler without having to type vector<typename std::iterator_traits<Iterator>::value_type>?

You use a deduction guide:

template<typename Iterator> vector(Iterator b, Iterator e) -> vector<typename std::iterator_traits<Iterator>::value_type>;

This tells the compiler that, when you call a vector constructor matching that pattern, it will deduce the vector specialization using the code on the right of ->.

You need guides when the deduction of the type from the arguments is not based on the type of one of those arguments. Initializing a vector from an initializer_list explicitly uses the vector's T, so it doesn't need a guide.

The left side doesn't necessarily specify a constructor. The way it works is that, if you use template constructor deduction on a type, it matches the arguments you pass against all deduction guides (actual constructors provide implicit guides). If there is a match, it uses that to determine which template arguments to provide to the type. But overload resolution to determine which constructor to call happens after that.

This also means that you can use guides with aggregates and aggregate initialization:

template<typename T>
struct Thingy
{
  T t;
};

Thingy(const char *) -> Thingy<std::string>;

Thingy thing{"A String"}; //thing.t is a `std::string`.

So deduction guides are only used to figure out the type being initialized. The actual process of initialization works exactly as it did before, once that determination has been made.

Detection Idiom - A Stopgap for Concepts--Simon Brand

Concepts are not yet here, but there are solutions.

Detection Idiom - A Stopgap for Concepts

by Simon Brand

From the article:

Concepts is a proposed C++ feature which allows succinct, expressive, and powerful constraining of templates. They have been threatening to get in to C++ for a long time now, with the first proposal being rejected for C++11. They were finally merged in to C++20 a few months ago, which means we need to hold on for another few years before they’re in the official standard rather than a Technical Specification. In the mean time, there have been various attempts to implement parts of concepts as a library so that we can have access to some of the power of Concepts without waiting for the new standard. The detection idiom – designed by Walter Brown and part of the Library Fundamentals 2 Technical Specification – is one such solution. This post will outline the utility of it, and show the techniques which underlie its implementation.

Volunteer at Meeting C++ 2017

For the first time ever, you can participate in Meeting C++ as a volunteer, just like you could do with CppCon!

Volunteering at Meeting C++ 2017

by Jens Weller

From the article:

Something new, which didn't exist in the last 5 editions of the Meeting C++ conference. You are now able to become a volunteer at Meeting C++ 2017, like you can and always could do for CppCon.

Historically the staff for Meeting C++ first was from my own C++ User Group...

What's new in clang-format 5

A good way to simplify your life:

What's new in clang-format 5

by Benoît Blanchon

From the article:

Clang 5 was released last week.
It's a good opportunity to talk about a not-enough-known tool: Clang-format.

Clang-format is part of the Clang project but can be used without the Clang compiler. It's an independent executable.

Clang-format is a code linter for C++. It takes a non-formatted code as input and produces a well-formatted code as output. The result is instantaneous.