experimental

C++ Modules - Spring Update—Gabriel Dos Reis

Let's talk about modules!

C++ Modules - Spring Update

by Gabriel Dos Reis

Abstract

“Modules” are a frequently requested and long-awaited feature by C++ programmers. The basic idea is a direct language support for (a) expressing the boundaries and dependencies of program components; (b) isolating source codes from macro vagaries; (c) scaling compile time, especially for large projects, given the ubiquity of “headers-only” template libraries; (d) spur innovation and deployment of semantics-aware developer tools. I will give an overview of the design points, goals, with emphasis on how modules address the four major problems mentioned above. I will also address standardization process and implementation issues

Jacksonville C++ Core Language Meeting Report—Jason Merrill

Here are the latest news about the future of C++:

Jacksonville C++ Core Language Meeting Report

by Jason Merrill

From the article:

There were three of us from Red Hat at the C++ meeting in Jacksonville, FL back in February, and it seems I never posted my trip report. So here it is now.

This was a fairly eventful meeting, as we’re rapidly approaching C++17 and so the big question on everyone’s minds was “What’s going to make it in?” In the end, many things did, but not Concepts, which some had been hoping for as a headline item.

We started and finished the week looking at the list of Technical Specifications that we were considering incorporating into C++17...

 

CppCon 2015 Ranges for the Standard Library—Eric Niebler

Have you registered for CppCon 2016 in September? Don’t delay – Early Bird registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

Ranges for the Standard Library

by Eric Niebler

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Range-based interfaces are functional and composable, and lead to code that is correct by construction. With concepts and ranges coming to the STL, big changes are in store for the Standard Library and for the style of idiomatic C++. The effort to redefine the Standard Library is picking up pace. Come hear about one potential future of the STL from one of the key people driving the change.

juCi++

juCi++ is a lightweight, platform independent C++-IDE with support for C++11, C++14, and experimental C++17 features depending on libclang version.

juCi++

About:

Current IDEs struggle with C++ support due to the complexity of the programming language. juCI++, however, is designed especially towards libclang with speed and ease of use in mind...

Quick Q:Is it possible in C++ to iterate over a std::map with unpacked key and value?

Quick A: An easy solution is not supported by the standard, it may come later.

Recently on SO:

Is it possible in C++ to do std::map<> “for element : container” iteration with named variables (eg, key and value) instead of .first and .second?

You could write a class template:

template <class K, class T>
struct MapElem {
    K const& key;
    T& value;

    MapElem(std::pair<K const, T>& pair)
        : key(pair.first)
        , value(pair.second)
    { }
};

with the advantage of being able to write key and value but with the disadvantage of having to specify the types:

for ( MapElem<int, std::string> kv : my_map ){
    std::cout << kv.key << " --> " << kv.value;
}

And that won't work if my_map were const either. You'd have to do something like:

template <class K, class T>
struct MapElem {
    K const& key;
    T& value;

    MapElem(std::pair<K const, T>& pair)
        : key(pair.first)
        , value(pair.second)
    { }

    MapElem(const std::pair<K const, std::remove_const_t<T>>& pair)
        : key(pair.first)
        , value(pair.second)
    { }
};

for ( MapElem<int, const std::string> kv : my_map ){
    std::cout << kv.key << " --> " << kv.value;
}

It's a mess. Best thing for now is to just get used to writing .first and .second and hope that the structured bindings proposal passes, which would allow for what you really want:

for (auto&& [key, value] : my_map) {
    std::cout << key << " --> " << value;
}

Using C++ Coroutines to simplify async UWP code—Eric Mittelette

The async pattern needed to write UWP apps (or simply "Universal apps") is not so easy to grasp, especially in C++. Eric from the Visual C++ team explains how the experimental Coroutines feature available in Visual Studio 2015 helps simplify async UWP code:

Using C++ Coroutines to simplify async UWP code

From the article:

C++ Coroutines can simplify your async code, and make the code easy to understand, write, and maintain...

Trip Report: C++ Standards Meeting in Jacksonville, February 2016—Botond Ballo

ANother trip report:

Trip Report: C++ Standards Meeting in Jacksonville, February 2016

by Botond Ballo

From the article:

Last week I attended a meeting of the ISO C++ Standards Committee in Jacksonville, Florida. This was the first committee meeting in 2016; you can find my reports on the 2015 meetings here (May 2015, Lenexa) and here (October 2015, Kona). These reports, particularly the Kona one, provide useful context for this post...