From Iterators to Ranges: The Upcoming Evolution Of the STL - Arno Schödl - @meetingcpp 2015
A new video highlight from Meeting C++ 2015:
From Iterators to Ranges: The Upcoming Evolution Of the STL
by Arno Schödl
June 16-21, Sofia, Bulgaria
September 13-19, Aurora, CO, USA
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 16-21, Kona, HI, USA
By Meeting C++ | Feb 14, 2016 07:35 AM | Tags: ranges performance intermediate efficiency c++17 c++14 c++11 boost basics advanced
From Iterators to Ranges: The Upcoming Evolution Of the STL
by Arno Schödl
By Marco Arena | Feb 12, 2016 06:58 AM | Tags: visual studio
The C++ compiler team is excited for you to try out the compiler in Visual Studio 2015 Update 2 CTP 1. Let’s dive into some of the feature improvements they have made in the compiler for Update 2:
Compiler improvements in VS 2015 Update 2
by Andrew Pardoe
From the article:
Since Update 1 we’ve made progress on being Standards-conformant for lot of C++11 and C++14 features...
By Blog Staff | Feb 11, 2016 06:04 PM | Tags: None
Note: This is the last batch of individually- or small-group-posted papers this week. Tomorrow is the pre-Jacksonville paper mailing deadline, so we expect a bunch of papers to come in all at once, and instead of blogging about them individually, those will all advertised here next week as part of the mailing blog post.
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.
P0186R0: Iterator Facade Library Proposal for Ranges (Beman Dawes, Eric Niebler, Casey Carter)
Proposes a library component for easily creating conforming iterators. Based on existing practice. Depends only on the C++17 working paper plus Concepts TS and Ranges TS. Breaks no existing code or ABI's. Two open-source implementations including test suites available. Proposed wording provided.
P0218R0: Adopt the File System TS for C++17 (Beman Dawes)
Technical work on N4100, File System Technical Specification, ISO/IEC TS 18822:2015, was completed in July 2014, and published by ISO in July 2015. There are three shipping implementations and one soon-to-ship implementation. Two of the shipping implementations have been have been in use for several years. This document proposes adopting the File System Technical Specification, with corrections, for C++17. The alternative to this proposal is to start work on version two of the File System TS. Doing nothing is not an alternative.
P0251R0: Unified Call Syntax Wording (Bjarne Stroustrup, Herb Sutter)
This is the proposed wording for a unified call syntax based on the idea that
f(x,y)
can invoke a member function,x.f(y)
, if there are nof(x,y)
. The inverse transformation, fromx.f(y)
tof(x,y)
is not proposed. [...] As agreed in EWG at the Kona meeting, the intent of the wording is: Forf(x,y)
, see iff(x,y)
is valid and if so do that call; otherwise tryx.f(y)
.
By Bjarne Stroustrup | Feb 11, 2016 12:17 PM | Tags: None
[This note from Bjarne provides some background for the updated structured bindings proposal posted yesterday. --Ed.]
In the context of the C++ Core Guidelines, we (Herb Sutter, Gabriel Dos Reis, me, and few others) were discussing sources of bugs and inefficiencies. We noticed that returning multiple values (e.g., from a tuple
) was one of the two remaining sources of uninitialized variables. We noticed that there were real cases of bugs and inefficiency (from default initialization followed by assignment rather than initialization) stemming from separating variable introduction from initialization. Use of tie()
is at best a partial solution that doesn’t get to the root of the problem.
The next day or so, Herb had a first draft of a proposal. We refined it, adding use cases and implications. I noted that we had a syntax in concepts for the introduction of multiple names that we could borrow. We noted that whatever we came up with had to fit into our ideas for a possible future far-more-general pattern matching design. We always try to ensure that a proposal doesn’t block an important potential evolution path. The design document for the proposal was refined and extended.
It was now obvious that the proposal completed C++’s mechanism for returning multiple values from a function: With structured binding, we can initialize a set of values, {x,y,z}
, just as we can return a set of values, {e1,e2,e3}
.
In web discussions, and especially at the Kona standards meeting, many alternatives were discussed. We focused on how to deal with user-defined types with private members. The new feature mustn’t discourage encapsulation by providing a convenient notation for structs only. We also considered whether explicit declaration of types were needed and how to achieve conversions. A conversion from a char[]
in a return value to a string
was considered particularly desirable by several people. These two needs were both addressed by adding the ability for users to define get<N>
functions for a class. Jens Maurer refined the proposed wording and in doing so found a few weaknesses in the design.
For the details and code examples, you can find the current proposal and wording papers here for the upcoming meeting in Jacksonville.
By Meeting C++ | Feb 11, 2016 06:36 AM | Tags: performance intermediate efficiency c++14 c++11 boost basics advanced
My series on building applications with Qt an boost continues:
Searching and replacing in strings with boost
by Jens Weller
From the article:
The next big milestone for my CMS is to actually generate HTML files, and I'm almost there. I'll reach it in the next two weeks, most code is written, just a little bit of refactoring is needed. This blog post is about searching and replacing in strings. As I started last week with implementing the functionality, that turns the data in my CMS into an HTML website.
There needs to be a lot of text transformed, in order to turn a shared structure like a cross page layout into a single, special HTML file, one of those transformations is, to replace the internal links with the correct links. A link to a different page in the same website cannot be represented as a text link, instead it is represented by a linkid, which corresponds to the Page it points to. This is to have still the correct link, if the page is renamed or moved...
By Adrien Hamelin | Feb 11, 2016 02:50 AM | Tags: c++14 advanced
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
By Adrien Hamelin | Feb 11, 2016 02:43 AM | Tags: c++11 basics
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.
By Blog Staff | Feb 10, 2016 05:28 PM | Tags: None
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:
tuplef(/*...*/) { /*...*/ 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.
By Blog Staff | Feb 10, 2016 09:59 AM | Tags: None
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
Excerpt:
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).
By robwirving | Feb 10, 2016 07:47 AM | Tags: None
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.