Overload 131 is now available

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

Overload 131

From the journal:

Defining Concepts
Concepts provide a new way of constraining code. Andrew Sutton shows us how to define and use them. by Andrew Sutton

On Zero-Side-Effect Interactive Programming, Actors, and FSMs
Functional programming is alien to many programmers. Sergey Ignatchenko considers parallels between actors and finite state machines.

Template Programming Compile Time Combinations & Sieves
Functional style frequently uses sequences. Nick Weatherhead applies these ideas to combinations in C++. by Nick Weatherhead

Classdesc: A Reflection System for C++11
C++ lacks direct support for reflection. Russell Standish brings an automated reflection system for C++, Classdesc, up to date. by Russell Standish

QM Bites : Maximising Discoverability of Virtual Methods
C++11 introduced override as a contextual keyword. Matthew Wilson encourages us to use it. by Matthew Wilson

So Why is Spock Such a Big Deal?
Spock testing in a Java environment is all the rage. Russel Winder talks through the history of testing on the JVM and demonstrates why Spock is so groovy. by Russel Winder

Modern C++ features: in-place construction—Arne Mertz

And emplace_back function:

Modern C++ features: in-place construction

by Arne Mertz

From the article:

Move constructors are often cheaper than copy constructors, which makes the construction and immediate relocation of objects in modern C++ more effective than in C++03. However, just moving the parts needed to construct the object in the right place can be even more effective. Several standard library functionalities use perfect forwarding to construct objects right where they are needed.

P0144R1 and P0217R0: Structured bindings (Sutter, Stroustrup, Dos Reis) and wording (Maurer)

New WG21 papers are available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.


P0144R1: Structured bindings (Herb Sutter, Bjarne Stroustrup, Gabriel Dos Reis)

This paper proposes the ability to declare multiple variables initialized from a tuple or struct, along the lines of:

tuple f(/*...*/) { /*...*/ return {a,b,c}; } 

auto {x,y,z} = f(); // x has type T1, y has type T2, z has type T3 

This addresses the requests for support of returning multiple values, which has become a popular request lately.

Proposed wording appears in a separate paper, P0217.


P0217R0: Proposed wording for structured bindings (Jens Maurer)

This paper presents the proposed wording to implement structured bindings as described by Herb Sutter, Bjarne Stroustrup, and Gabriel dos Reis in P0144R1.


P0221R0: Proposed wording for default comparisons, revision 2—Jens Maurer

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: P0221R0

Date: 2016-02-10

Proposed wording for default comparisons, revision 2

by Jens Maurer


This paper presents design rationale and proposed wording to implement default comparisons for class types. It is a revision of N4532 with additional updates from the Evolution Working Group session at the Kona meeting of WG21 and in-depth discussions with interested parties. Blue text in the proposed wording indicates changes compared to N4532.

This paper assumes that the reader is familar with N4475 "Default comparisons (R2)" by Bjarne Stroustrup. In particular, default comparisons are assumed to be implicit (i.e. require no extra syntax to be available). 

CppCast Episode 44: HPC and more with Bryce Lelbach

Episode 44 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Bryce Lelbach to discuss High Performance Computing and other C++ topics.

CppCast Episode 44: HPC and more with Bryce Lelbach

by Rob Irving and Jason Turner

About the interviewee:

Bryce Adelstein Lelbach is a researcher at Lawrence Berkeley National Laboratory (LBNL), a US Department of Energy research facility. Working alongside a team of mathematicians and physicists, he develops and analyzes new parallel programming models for exascale and post-Moore architectures. Bryce is one of the developers of the HPX C++ runtime system; he spent five years working on HPX while he was at Louisiana State University's Center for Computation and Technology. He also helped start the LLVMLinux initiative, and has occasionally contributed to the Boost C++ libraries. Bryce is an organizer for C++Now and CppCon conferences and he is passionate about C++ community development. He serves as LBNL's representative to the C++ standards committee.

C++ track at NDC Oslo 2016, June 6-10 (CFP ends Feb 15)

For the third year in a row we will set up a strong C++ track at the NDC conference in Oslo, June 6-10. 

   The Call for Paper ends February 15   

At NDC Oslo the typical crowd of 2000+ developers can choose from 9-10 parallel tracks over 3 long days (June 8-10). One of these tracks will be about C++, but there will be tracks on embedded programming, security and IoT just to mention a few. There are also many preconference 2-day tutorials/workshops (June 6-7) and several of these will be on C++ and C (stay tuned).

We have already signed up several solid C++ speakers. Anthony Williams, Mark Isaacson, Hubert Matthews, Dan Saks, Andrei Alexandrescu, will be there. Will you? We have a few more slots available. In particular we are looking for C++ gurus based in Europe. Feel free to also contact Olve Maudal directly if you are interested.

If you are curious about the NDC conference please take a look at the humorous promo video for last years event.

Sometimes you get things wrong—Marshall Clow

What is the best thing to return?

Sometimes you get things wrong

by Marshall Clow

From the article:

A few years ago, Sean Parent challenged me to provide an implementation of Boyer-Moore searching in C++. I did that, first in boost and then, later as part of the proposed Library Fundamentals Technical Specification.

The idea here is that you have a searcher object, which encapsulates the actual searching. You construct it with the pattern that you want to search for, and then you call the searchers operator() with the corpus that you want to search, and it will return to you the start of the pattern in the corpus, if it exists, and the end of the corpus, if it does not (this is the same set of rules that std::search follows).

But this weekend I realized that this is not the right thing to return. The searcher (and std::search for that matter) should return a “range” (ok, a pair of iterators) denoting the beginning and end of the pattern in the corpus. (Yes, you can get the end of the pattern by incrementing the returned iterator by the length of the pattern, but that’s an O(N) operation if you only have forward iterators...

Fundamentals of Type-Dependent Code Reuse - Mark Isaacson - NDC Oslo 2015

From NDC Oslo 2015:

Fundamentals of Type-Dependent Code Reuse

by Mark Isaacson

About the video:

This talk surveys different code reuse problems that can be solved by leveraging type information. Mark talks about how you can optimize your algorithms so that certain types use a "fast path", all while hiding that complexity from your users. He also talks about various ways to create "opt-in" functions for your classes. The talk is accessible to novices but builds gradually to complex ideas, including a theoretical C++17 "Mixer" class that allows users to add arbitrary functions to any type, including ints, on an instance by instance granularity.

build2 — C++ Build Toolchain

build2 is an open source, cross-platform toolchain for building and packaging C++ code. It includes a build system, package manager, and repository web interface. There is also, a public repository of open source C++ packages.

build2 — C++ Build Toolchain

From the announcement:

This is the first alpha release and currently it is more of a technology preview rather than anything that is ready for production. It has been tested on various Linux'es, Mac OS, and FreeBSD. There is no Windows support yet (but cross-compilation is supported).