N4221: Generalized lifetime extension -- David Krauss

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

Date: 2014-10-10

Generalized lifetime extension

by David Krauss

Excerpt:

A model is introduced to describe the association between a value, and the object or objects needed to represent it. This enables a generalization of lifetime extension, applicable to constructors and accessor functions which opt in using the export keyword. The current lifetime extension behavior is also more elegantly described, and the “temporary expression” controversy is resolved. This resolves EWG 120 and many other dangling reference issues.

N4220: An update to the preprocessor specification (rev. 2) -- David Krauss

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

Date: 2014-10-10

An update to the preprocessor specification (rev. 2)

by David Krauss

Excerpt:

This proposal updates the preprocessor specification to remove undefined behavior, missing specifications, and possible contradictions, and to better document implementation differences. It resolves CWG DR 268, 366, 897, 1436, 1625, 1698, 1709, 1718, and 1882. Issues related to universal-character-names are not addressed here, but in N4219.

N4219: Fixing the specification of universal-character-names (rev. 2) -- David Krauss

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

Date: 2014-10-10

Fixing the specification of universal-character-names (rev. 2)

by David Krauss

Excerpt:

The present paper will review several corner cases, considering the natural response of models A, B, and C, and the actual behavior of GCC and Clang. This leads to a specification permitting implementation flexibility without ambiguity.

N4211-13: File System TS Issues Lists -- Beman Dawes

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 numbers: N4211-13

Date: 2014-10-11

File System TS Active Issues List (Revision R3)

File System TS Closed Issues List (Revision R3)

File System TS Defect Report List (Revision R3)

by Beman Dawes

Overload 123 is now available

overload-123.PNGOverload 123 is now available. It contains the following C++-related articles, and more:

 

Overload 123

Alternative Overloads

[No pun intended. --Ed.] How do you return a default value given a condition? Malcolm Noyes presents solutions using older and newer C++ techniques.

Debug Complexity: How Assertions Affect Debugging Time

Debugging any program can be time consuming. Sergey Ignatchenko and Dmytro Ivanchykhin extend their mathematical model to consider the effect of assertions.

Defining Visitors Inline in Modern C++

The Visitor pattern can involve non-local boilerplate code. Robert Mill and Jonathan Coe present an inline VISITOR in C++.

N4183: Contiguous Iterators: Pointer Conversion & Type Trait -- Nevin Liber

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

Date: 2014-10-10

Contiguous Iterators: Pointer Conversion & Type Trait

by Nevin Liber

Excerpt:

This is a proposal to:

  • Add a mechanism for converting a contiguous iterator to a pointer
  • A type trait for contiguous iterators
It builds upon the discussion in Issaquah on the previous version of this paper (n3884) and is dependent on n4132 Contiguous Iterators by Jens Maurer.

N4190: Removing auto_ptr, random_shuffle(), And Old Stuff -- Stephan T. Lavavej

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

Date: 2014-10-09

Removing auto_ptr, random_shuffle(), And Old Stuff

by Stephan T. Lavavej

Excerpt:

The C++ Standard is big.  We should make it smaller by removing stuff we don't need anymore, like features that have been deprecated for years and thoroughly superseded by more modern machinery.

N4161: Uniform Container Erasure (Revision 1) -- Stephan T. Lavavej

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

Date: 2014-10-09

Uniform Container Erasure (Revision 1)

by Stephan T. Lavavej

Excerpt:

This is a proposal to add erase_if(container, pred) and erase(container, value), making it easier to eliminate unwanted elements correctly and efficiently.  This updates N4009 (see [1]) which proposed erase_if(), by adding erase() and answering additional questions.  Please see the original proposal for the rationale behind this feature, which is not repeated here.

N4206-08: Evolution Issues Lists -- Ville Voutilainen

New WG21 papers are available. Copies are linked below, and 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 numbers: N4206-08

Date: 2014-10-09

C++ Standard Evolution Active Issues List (Revision R09)

C++ Standard Evolution Completed Issues List (Revision R09)

C++ Standard Evolution Closed Issues List (Revision R09)

by Ville Voutilainen

Excerpt:

The purpose of this document is to record the status of issues which have come before the Evolution Working Group (EWG) of the INCITS PL22.16 and ISO WG21 C++ Standards Committee. Issues represent potential defects in the ISO/IEC IS 14882:2003(E) document, and proposed extensions to it.

Quick Q: Why is "want speed? pass by value" not recommended? -- StackOverflow

Quick A: Because it performs worse than C++98 for common types like string and vector. The preferred way to optimize for rvalues is to add a && overload.

Fresh on SO:

Why is value taking setter member functions not recommended in Herb Sutter's CppCon 2014 talk (Back to Basics: Modern C++ Style)?

In Herb Sutter's CppCon 2014 talk Back to Basics: Modern C++ Style he refers on slide 28 (a web copy of the slides are here) to this pattern:

class employee {
  std::string name_;
public:
  void set_name(std::string name) noexcept { name_ = std::move(name); }
};

He says that this is problematic because when calling set_name() with a temporary, noexcept-ness isn't strong (he uses the phrase "noexcept-ish").

Now, I have been using the above pattern pretty heavily in my own recent C++ code mainly because it saves me typing two copies of set_name() every time -- yes, I know that can be a bit inefficient by forcing a copy construction every time, but hey I am a lazy typer. However Herb's phrase "This noexcept is problematic" worries me as I don't get the problem here: std::string's move assignment operator is noexcept, as is its destructor, so set_name() above seems to me to be guaranteed noexcept. I do see a potential exception throw by the compiler before set_name() as it prepares the parameter, but I am struggling to see that as problematic.

Later on on slide 32 Herb clearly states the above is an anti-pattern. Can someone explain to me why lest I have been writing bad code by being lazy?