A Look at C++14 and Beyond: Papers Part 4 -- Meeting C++

And the final part 4:

A look at C++14 and beyond: Papers Part 4

This is the 4th and last part about the Pre-Bristol mailing and its papers. This series has given me a good overview, what is up in the future in C++. Still, some things are missing, not all will come to shine in this series. I have no papers with actual proposals skipped, but a few papers are only to find in the January mailing, and not in this one. One of them is for example a paper on filesystem, which should make it into C++14. However, there will be a follow up to this series. At the next meeting of my local C++ User Group we are going to have a video call with Michael Wong and other attendees of the meeting. This will be an interesting chat for sure, and help me refine my view on C++14 and C++17 Standards. I'll write this down in the follow up, featuring also some of the feedback that has come.

Before I start with the last 23 Papers, I'll want to shortly mention where this idea has come from. Last fall I saw two blog entries about the Portland Meeting, each naming a few favorite papers and a short summary of them. One was Japanese, and one was Korean, as far as I remember. I had never seen anything like this in the west, no blog, no site brought anything about the papers. Organizing Meeting C++ did not give me the time, to do something similar back then. The decision to cover all papers came, as I wanted to read through most papers any way, and most papers are worth reading. I'm not yet sure if I do something similar for the Chicago Meeting, as this is very time consuming, and therefore would like to state, that I do look for possible Sponsors helping me doing this.

But, lets get started on some papers...

New paper: N3621, Minutes, WG21 Teleconference 2013-03-29 -- Kyle Kloepper

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3621

Date: 2013-03-29

Minutes, WG21 Teleconference 2013-03-29

by Kyle Kloepper

Excerpt:

Meredith asks if core is in a good place to vote out C++14 in Bristol. Miller confirms that CWG is ready for a CD. Holes in C++11 have been plugged. CWG is in a better place than FDIS for C++11.

[...] tentative schedule for evening [sessions at the Bristol meeting]:

  • (Mon) OpenMP
  • (Tue) Alisdair: C++11 allocator best practices
  • (Wed) Concepts Lite update
  • (Thu) TM [Transactional Memory]

​[Ed.: And likely also: (Fri) C/C++ compatibility. This is a record number of evening sessions.]

New paper: N3631, C11: The New C Standard -- Tom Plum

Note: Both this paper by Tom Plum and the other just posted by Bjarne Stroustrup refer to prior published articles about C and C++ compatibility. The reason for drawing attention to that information is that C and C++ compatibility is now expected to be discussed at next week's ISO C++ meeting in Bristol. For an example why this discussion is taking place now, see paper N3557 section 7, which raises the question of compatibility between C and C++ for parallelism, including that pressure from C choices affects our design choices for C++ as well.

However, the C++ committee's focus at Bristol is still on working toward a Committee Draft ballot for C++14. This C/C++ compatibility discussion is expected to take place late in the meeting when the technical work for C++ in general and C++14 in particular is complete.

 

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3631

Date: 2013-04-09

C11: The New C Standard

by Tom Plum

Excerpt, including explaining why the above title is not a link:

This material was originally published in a series of articles in Dr. Dobb’s (www.drdobbs.com) and is reprinted here, with permission, for use by C++ committee members. Outside the committee, please refer to readers to the following links, rather than distributing this document. (Copyright 2012 Dr. Dobb’s)

http://www.drdobbs.com/cpp/232800444 (C11 overview, concurrency, etc.)

http://www.drdobbs.com/cpp/232901670 (C11 security, Annex K, Annex L)

http://www.drdobbs.com/cpp/240001401 (Alignment, Unicode, ease‐of‐use features, C++ compatibility)

New paper: N3628, C and C++ Compatibility -- Bjarne Stroustrup

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3628

Date: 2013-04-08

C and C++ Compatibility

by Bjarne Stroustrup

Excerpt:

It seems that a serious discussion about C/C++ compatibility is starting. “By popular demand,” here is a paper in three parts that I wrote just over 10 years ago. Much have changed since that, so please don’t expect the paper to be completely up-to-date or to completely reflect my current views. However, I don’t have the time to write a 2013 version of these 2002 papers, and I don’t change my fundamental opinions all that often. I think that C/C++ compatibility is very important and valuable for both the C and C++ communities.

  • C and C++: Siblings. The C/C++ Users Journal. July 2002.
  • C and C++: A Case for Compatibility. The C/C++ Users Journal. August 2002.
  • C and C++: Case Studies in Compatibility. The C/C++ Users Journal. September 2002.

Quick Q: How Can Use a Lambda Function as a Hash Function for unordered_map? -- StackOverflow

Quick A: Name the lambda (by assigning it to a variable), then decltype it.

People sometimes ask this, so it's worth putting out a quick link to the short answer:

How to use lambda function as hash function in unordered_map?

I wonder if it is possible to use lambda function as custom hash function for unordered_map in C++11? If so, what is the syntax?

Quick Q: Why might a C++11 range-for loop appear slow? -- StackOverflow

Quick, can you spot the problem in this line of code?

for(vector<int> vec1 : backgroundData)

Probably you can -- but what's the best solution?

Read on here, yesterday on StackOverflow:

C++11: Why does this range loop decrease FPS by 35?

[...] Is the C++11 range-based loop so much slower than the old school for? I really want to hear an answer to this, because my eyes honestly prefer the range based loop, and I'd hate to find out that the range based loop is twice as slow.

 

Universal References (revisited) -- Ben Hekster

A response to Scott Meyers' recent article on Universal References, showing an analogy between &&-collapsing and const-collapsing, and making the counterargument that inventing a new concept may not be needed to clearly explain the standard. It's always interesting to see different experts' takes on how to understand and teach a  feature, particularly a new C++11 feature that we as a community are still absorbing.

Universal References

by Ben Hekster

... The ‘universal reference’ is not a concept you will see defined in the C++ standard, nor is it even something that has any conceptually objective existence in the language or compilation process. It is a construct defined by Meyers in an attempt to make some sense of behavior in the language that he presents as being unexpected or even mysterious. On closer inspection, however, I find that the observed mysterious behavior is actually quite readily explained and has an existing analog that corresponds to already intuitively-understood behavior. ...

Complex Initialization for a Const Variable -- Herb Sutter

How do you declare a const int variable when you have still have to do some computation to initialize it (so it shouldn't be const at first) but then want it be const after that?

Complex Initialization for a Const Variable

by Herb Sutter

 

On std-discussion, Shakti Misra asked:

> I have seen in a lot of places code like

int i;
if(someConditionIstrue)
{
    Do some operations and calculate the value of i;
    i = some calculated value;
}
use i; //Note this value is only used not changed. It should not be changed.

 

Olaf nailed it: The way to do it is with a lambda. ...

A Look at C++14 and Beyond: Papers Part 3 -- Meeting C++

And part 3:

A look at C++14 and beyond: Papers Part 3

This is the 3rd part of my little series over the papers in the Pre-Bristol mailing. I have added "and beyond" to the title, as I decided to handle all papers with Part 2, and now will continue to do so. This edition will again feature a few highlights, and a lot of proposals from different areas of C++.

Also, please understand, that all of the papers here are proposals. None of them are voted into any standard yet, maybe Bristol will give us a hint about what to expect for C++14, maybe not. Still, the proposals will give an impression, on what C++14 could be like.