N4015: A proposal to add a utility class to represent expected monad -- V. Escriba and P. Talbot

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

Date: 2014-05-20

A proposal to add a utility class to represent expected monad

by Vicente J. Botet Escriba and Pierre Talbot

Excerpt:

Class template expected<E,T> proposed here is a type that may contain a value of type T or a value of type E in its storage space. T represents the expected value, E represents the reason explaining why it doesn't contains a value of type T, that is the unexpected value. Its interface allows to query if the underlying value is either the expected value (of type T) or an unexpected value (of type E). The original idea comes from Andrei Alexandrescu C++ and Beyond 2012: Systematic Error Handling in C++ talk. The interface and the rational are based on std::optional N3793 and Haskell monads. We can consider that expected<E,T> is a generalization of optional<T> providing in addition a monad interface and some specific functions associated to the unexpected type E. It requires no changes to core language, and breaks no existing code.

N3989: Working Draft, Technical Specification for C++ Extensions for Parallelism -- Jared Hoberock

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

Date: 2014-05-23

Working Draft, Technical Specification for C++ Extensions for Parallelism

by Jared Hoberock

Excerpt:

This Technical Specification describes requirements for implementations of an interface that computer programs written in the C++ programming language may use to invoke algorithms with parallel execution. The algorithms described by this Technical Specification are realizable across a broad class of computer architectures. ... The goal of this Technical Specification is to build widespread existing practice for parallelism in the C++ standard algorithms library.

ACCU 2014 talk slides now available

[Ed: Here's a candidate for the most hilarious thing you'll probably see today: Kevlin Henney's slide deck, including a link to this @netbat tweet.]

The recent ACCU 2014 was another resounding success, and many of the talk slides have now been posted. You can find them here:

Slides, Photos, Blogs via #accu2014 (accu.org)

Some fun C++ highlights with slides available include:

  • Dietmar Kuhl · Performance Choices
  • Howard Hinnant · Everything You Ever Wanted To Know About Move Semantics (and then some)
  • Hubert Matthews · Where is C++ headed?
  • Jonathan Wakely · There Ain't No Such Thing As A Universal Reference
  • Jonathan Wakely · The C++14 Standard Library
  • Kevlin Henney · Immutabilty FTW!
  • Marshall Clow · C++ Undefined Behavior -- what is it, and why should I care?
  • Olve Maudal · C++ Pub Quiz
  • Pattabi Raman · Random number generation in C++ -- present and potential future
  • Peter Sommerlad · C++14 an overview on the new standard for C++(11) programmers
  • Steve Love · Range and Elevation -- C++ in a modern world
  • ... and more (see the page).

Qt 5.3 released

 

Qt 5.3 is now available.

Qt is the most widely-known and -used portable UI framework for C++. It offers native code performance and modern sophisticated user experiences across desktop, embedded, and mobile platforms. Both commercial and open source versions are available.

More details from the Qt 5.3 product page:

With Qt 5.3 a lot of effort was put into enhancing the overall quality and user experience across all the platforms. Qt 5.2 introduced a completely new dimension into cross-platform: the mobile platforms and it has been downloaded an amazing amount of more than 1 million times!

...

  • Added Qt Positioning API support for Android and iOS. Use the GPS directly from convenient Qt APIs!
  • Qt Bluetooth API has now support for Android as well
  • Printing support for Qt has been greatly enhanced
  • Qt 5.3 ships with Qt Creator 3.1, which also introduced a lot of enhancements and stability to existing features as well as an initial support for WinRT tooling, a new clang-based code model and improved Android tool chain integration.

CppCon: My Proposed Talks (Part 2) -- Herb Sutter

cppcon-108.PNGFollowing up on Herb's three talk proposals posted yesterday, the other two titles and abstracts are now posted, this time of new talks (note: again, pending review and selection by the program committee, so this is not final -- they may or may not be selected if there is stronger material).

CppCon: My Proposed Talks (Part 2)

by Herb Sutter

From the post:

GC for C++, and C++ for GC: “Right” and “Wrong” Ways to Add Garbage Collection to C++ (1 to 2 hours)

"Garbage collection is essential to modern programming!" "Garbage collection is silly, who needs it!"

As is usual with extremes, both of these statements are wrong. Garbage collection (GC) is not needed for most C++ programs; we're very happy with determinism and smart pointers, and GC is absolutely penalizing when overused, especially as a default (or, shudder, only) memory allocator. However, the truth is that GC is also important to certain high-performance and highly-concurrent data structures, because it helps solve advanced lock-free problems like the ABA problem better than workarounds like hazard pointers.

This talk presents thoughts about how GC can be added well to C++, directly complementing (not competing with) C++'s existing strengths and demonstrating why, as Stroustrup says, "C++ is the best language for garbage collection."

 

Addressing C++’s #1 Problem: Defining a C++ ABI (1 hour)

"Why can't I share C++ libraries even between my own internal teams without using the identical compiler and switch settings?" "Why are operating system APIs written in unsafe C, instead of C++?" "Why can’t I use std::string in a public shared library interface; it's the C++ string, isn't it?!"

These and more perennial questions are caused by the same underlying problem: For various historical reasons, C++ does not have a standard binary interface, or ABI. Partial solutions exist, from the Itanium ABI which addresses only the language and only on some platforms, to COM and CORBA which do both less and far more than is needed.

It is deeply ironic that there actually is a way to write an API in C++ so that it has a de facto stable binary ABI on every platform: extern "C".

This session describes current work driven by the presenter to develop a standard C++ ABI. This does not mean having identical binaries on all platforms. It does mean tackling all of the above problems, including directly addressing the #1 valid reason to use C instead of C++, and removing a major obstacle to sharing binary C++ libraries in a modern way.

libstudxml: A modern XML API for C++

libstudxml.PNGlibstudxml is an XML library for modern, standard C++. It has an API that I believe should have already been in Boost or even in the C++ standard library.

The API was first presented at the C++Now 2014 conference. Based on the positive feedback and encouragement I received during the talk, I've decided to make the implementation generally available.

As an example, we can parse this XML:

<person id="123">
  <name>John Doe</name>
  <age>23</age>
  <gender>male</gender>
</person>

With the following C++ code, which performs all the validation necessary for this XML vocabulary:

enum class gender {...};

ifstream ifs (argv[1]);
parser p (ifs, argv[1]);

p.next_expect (parser::start_element, "person", content::complex);

long id = p.attribute<long> ("id");

string n = p.element ("name");
short a = p.element<short> ("age");
gender g = p.element<gender> ("gender");

p.next_expect (parser::end_element); // person

The API has the following interesting features:

  • Streaming pull parser and streaming serializer
  • Two-level API: minimum overhead low-level & more convenient high-level
  • Content model-aware (empty, simple, complex, mixed)
  • Whitespace processing based on content model
  • Validation based on content model
  • Validation of missing/extra attributes
  • Validation of unexpected events (elements, etc)
  • Data extraction to value types
  • Attribute map with extended lifetime (high-level API)

libstudxml is compact, external dependency-free, and reasonably efficient. The XML parser is a conforming, non-validating XML 1.0 implementation that is based on tested and proven code. The library is released under the MIT license.

More information, documentation, and source code are available from libstudxml project page. Or, you can jump directly to the API description with examples.

N4000: Standard Wording for a Transaction-safe C++ Standard Library std::list -- Michael Wong et al.

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

Date: 2014-05-23

Standard wording for a Transaction-safe C++ Standard Library std::list

by Michael Wong, et al.

Excerpt:

This paper documents our effort to transactionalize a C++ Standard Template Library (STL) container to demonstrate the feasibility of the transactional language constructs proposed by Study Group 5 (SG5): Transactional Memory. We began this study with std::list and made it transaction-safe using the transactional memory support in GCC 4.9. ...

Changes from previous versions

N4000 (this paper): present updates and summary from LEWG and propose wording for TM TS for LWG

N3990: Adding standard circular shift operators for computer integers -- D Gutson, A Bustamente

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

Date: 2014-05-08

Adding standard circular shift operators for computer integers

by Daniel Gutson, Angel Bustamente

Excerpt:

C and C++ languages have the standard set of bitwise operations, including OR, AND, XOR, LEFT/RIGHT SHIFT, NOT. However, circular shift (left and right rotate) isn't included in the language.

N3987: Yet another set of C++ type traits -- Cleiton Santoia Silva and Daniel Auresco

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

Date: 2014-05-07

Yet another set of C++ type traits

by Cleiton Santoia Silva and Daniel Auresco

Excerpt:

Just as exercise you can pick all keywords of C++ and put a is_ before and thought if it make sense.

N3986: Adding Standard support to avoid padding within structures -- Davalle, Gutson, Bustamente

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

Date: 2014-04-25

Adding Standard support to avoid padding within structures

by Sebastian Davalle, Daniel Gutson, Angel Bustamante

Excerpt:

Sometimes programmers might need to avoid the bitfields’ alignment to get a compact type. Although this behavior can be obtained in most compilers by specifying the "packed" attribute, a more standard and simpler way to force it should exist (similar to the :0 syntax).