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.

New paper: N3552, Introducing Object Aliases -- 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: N3552

Date: 2013-03-12

Introducing Object Aliases

by Walter Brown

Excerpt:

A number of years ago, [Bro05] explored a prospective language feature then known as Object Templates. That feature died on the vine due to healthy skepticism voiced by EWG, as well as the usual lack of cycles to develop the idea much further. However, the original underlying issue is still present in C++11, after even many additional years of experimental effort to achieve the desired effect via C++03 or (more recently) C++11 syntax.

Fortunately, C++11 also points the way toward a more general solution, well beyond that envisioned over a decade ago. Accordingly, this paper incorporates and updates a significant fraction of the earlier [Bro05] in introducing a different proposed C++ feature. Inspired by the C++11 template alias for types, we will propose a template alias for objects, known in brief as an object alias.

New paper: N3551, Random Number Generation in C++11 -- Walter Brown

Ed.: Most standardization papers are about technical changes. It's not often you get a tutorial written by a world-class expert submitted as a WG21 paper. Thanks, Walter!

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

Date: 2013-03-12

Random Number Generation in C++11

by Walter Brown

Excerpt:

For programmers seeking to familiarize themselves with the <random> component of the
C++11 standard library, we provide background information and tutorial guidance with numerous
usage examples.

1 Introduction 1
2 Getting started 2
3 An anti-pattern 3
4 Initializing an engine 3
5 What else can an engine do? 4
6 Engines in the standard library 5
7 Sharing an engine 5
8 Distributions in the standard library 6
9 What else can a distribution do? 8
10 A simple toolkit 9
11 A final example 9
12 Caveat lector! 10
13 What’s next? 11
14 Acknowledgments 11
15 Bibliography 11
16 Revision history 12