March 2013

Preconditions, Part 3 -- Andrzej Krzemieński

Andrzej continues with a third installment in his series on preconditions.

Preconditions, Part 3

by Andrzej Krzemieński

In this post, I examine a couple of cases and try to answer the question when and how to specify preconditions, and when it is better not to do it. I believe it gives a deeper insight into the nature of preconditions.

New paper: N3583, Exploring constexpr at Runtime -- Scott Schurr

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

Date: 2013-03-13

Exploring constexpr at Runtime

by Scott Schurr

Excerpt:

The paper explores motivations for either a) constraining selected constexpr functions and constructors so they may only be used during translation, or b) overloading on constexpr so different implementations could be provided for translation-time vs. run-time execution. Two examples are examined for motivation. Then the paper explores four approaches to providing the constraints.

New paper: N3578, Proposing the Rule of Five -- Walter Brown

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

Date: 2013-03-12

Proposing the Rule of Five

by Walter Brown

Excerpt:

This paper proposes to obsolete the deprecated behavior, giving C++14 a true “rule of five” instead of the traditional “rule of three.”

New paper: N3575, Additional Standard allocation schemes -- Mark Boyall

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

Date: 2013-03-10

Additional Standard allocation schemes

by Mark Boyall

Excerpt:

The Standard provides an allocator abstraction, but does not provide any useful allocators beyond the default. This means that every user must roll their own memory allocators for non-trivial allocation schemes. Many of these schemes are common and are quite suitable for Standardization. They are also prone to subtle errors, especially where those supporting concurrent use, are concerned. Shipping these allocators in the Standard would significantly increase the ability of users to improve the performance of their programs with minimal effort. In addition, a more suitable choice of default allocator for some containers could provide a substantial speedup for existing user programs with no effort on their behalf. Finally, synchronization is an issue. Hidden synchronization inside allocators can result in unnecessary performance drains. Now that the Standard includes concurrency, it is necessary to deal with its costs in Standard mechanisms. Code which runs on one thread, either because that program simply does not use concurrency or because that specific subset is single-threaded, must unnecessarily pay the costs of synchronizing calls to the default allocator.

New paper: N3574, Binding stateful functions as function pointers -- Mark Boyall

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

Date: 2013-03-10

Binding stateful functions as function pointers

by Mark Boyall

Excerpt:

This proposal is motivated by the lack of a means to pass stateful functions to C APIs as a function pointer. Solving this problem would benefit everybody who has to call into a C API. The approach outlined here of a thunk, or trampoline, is well-understood and used commonly in language implementations which include a JIT compiler.

New paper: N3573, Heterogenous extensions to unordered containers -- Mark Boyall

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

Date: 2013-03-10

Heterogenous extensions to unordered containers

by Mark Boyall

Excerpt:

[C]urrently, it is impossible to look up by a type other than the key type. This sounds reasonable but is actually fairly limiting. ... Secondly, it is impossible to override the hash or equivalence function for a given lookup. ...

New paper: N3572, Unicode Support in the Standard Library -- Mark Boyall

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

Date: 2013-03-10

Unicode Support in the Standard Library

by Mark Boyall

Excerpt:

The purpose of this document is to propose new interfaces to support Unicode text, where the existing interfaces are quite deficient.

New paper: N3568, Shared locking in C++, Revision 1 -- Howard Hinnant

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

Date: 2013-03-11

Shared locking in C++, Revision 1

by Howard Hinnant

Excerpt:

N3427 was presented at the Fall 2012 meeting in Portland to SG1 (Concurrency and Parallelism). The only objection at that meeting was to not allowing spurious failure for the try and timed locking and conversion locking functions of shared_mutex and upgrade_mutex.

Changes compared to N3427: The remarks about disallowing spurious failures have been removed.

...

This proposal adds functionality to allow clients to easily code the well-known multiple-readers / single-writer locking pattern.
This proposal adds:

1. Seven constructors to unique_lock<Mutex>These constructors serve as explicit try and timed conversions from shared_lock and upgrade_lock.

2. A new header: <shared_mutex>, containing:

  • class shared_mutex;
  • class upgrade_mutex;
  • template <class Mutex> class shared_lock;
  • template <class Mutex> class upgrade_lock;

New paper: N3553, Proposing a C++1Y Swap Operator -- Walter Brown

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

Date: 2013-03-12

Proposing a C++1Y Swap Operator

by Walter Brown

Excerpt:

This paper proposes a new swap operator for incorporation into C++1Y. It further proposes that this new operator be treated as a special member function, and that, when viable, its presence provide an alternative to traditional memberwise implementation of defaulted assignment semantics.