February 2016

N4573: February 2017 WG21 Meeting -- Tom Plum

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: N4573

Date: 2016-02-02

February 2017 WG21 Meeting

by Tom Plum

Excerpt:

The February 2017 WG21 meeting is sponsored by Plum Hall and the Standard C++ Foundation. The meeting will take place at the Royal Kona Resort, in Kailua-Kona Hawaii, Monday Feb 27 to Saturday Mar 04.

Emulating C++17 Structured Bindings in C++14--John Bandela

How to use tuple return values with ease?

Emulating C++17 Structured Bindings in C++14

by John Bandela

From the article:

Bjarne Stroustrup back in Novemeber wrote a nice progress report, available here, of the Kona meeting. One of the proposals considered is called structured binding. The proposal addresses one of the inconveniences of returning multiple values from a function using tuples. While, it is very easy for a function to return multiple values, it is harder for the caller to use them. Here is an example from the write up.

consider the following function

tuple<T1,T2,T3> f() { /*...*/ return make_tuple(a,b,c); }

If we want to split the tuple into variables without specifying the type, we have to do this;

auto t = f();
auto x = get<1>(t);
auto y = get<2>(t);
auto z = get<3>(t);

The proposal puts forth the following syntax instead

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

I am excited for this feature, and for C++17 in general. While waiting for C++17, I decided to see how close I could get with C++14. Here is the result.

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

// Unlike the C++17 feature, you need to use r.x instead of just x
std::cout << r.x << "," << r.y << "," << r.z << "\n";

C++ User Group Meetings in February

The monthly listing of upcoming C++ User Group meetings at Meeting C++:

C++ User Group Meetings in February

by Jens Weller

From the article

The monthly overview on the upcoming C++ User Group meetings! In the shortest month of the year there are still 21 C++ User Groups which are meeting!

There are 7 new C++ User Groups: Sofia, Ho Chi Minh, Iasi, Noida, Macedonia, Buenos Aires, Stuttgart / Ludwigsburg (Qt).

Constructor Failures--Arne Mertz

Constructing or not constructing, that is the question.

Constructor Failures

by Arne Mertz

From the article:

Sometimes we fail to acquire a needed resource or responsibility during the construction of an object. Sometimes the construction of a subobject fails. How can we deal with an incompletely constructed object?

 

Experiments in partition and remove -- Brent Friedman

An analysis and exploration of partition and remove algorithms. By combining aspects of these two, we rediscover useful algorithms that the Standard Library doesn't have.

Experiments in partition and remove

by Brent Friedman

From the article:

The C++ Standard Library exposes dozens of powerful algorithms for use in everyday software. Two of these algorithms, partition and remove_if, provide similar functionality for segregating data. If we dig carefully into implementations of these algorithms, a certain symmetry is exposed. This exploration will lead us to the discovery of useful algorithms that we can employ in our daily engineering work.
This article demonstrates particular algorithm implementations — but it is important to remember that the source code will vary between different implementations of the standard library, and can differ based on what sort of data you pass in.