SD-6 additions from Jacksonville meeting

Here is what I have done to try to capture the changes to C++17 from Jacksonville.

The vast majority of the library proposals include a proposed name for the feature-test macro. (Yay!) They are all included in the table. But none of the language proposals did, and a few of the library proposals didn't say anything.

I have added some proposals of my own, marked with a question mark. Note that for range-based "for", constexpr lambdas, and fold expressions, the proposal is to bump an existing macro. (The target of the link from the new value is in SD-6; it dangles in this document.)

For the enum class value change, the "design mistake", and non-const data for string, the proposal is that no macro is needed; rationale is included.

The fundamentals TS (and to a lesser degree the parallelism TS) make it not obvious what to do about keeping the table sorted by primary section number.

Most of the document links are broken now, but should start working when the post-meeting mailing is posted.

Significant changes to C++17
Doc. No. Title Primary Section Macro Name Value Header
P0245R1 Hexadecimal floating literals for C++ 2.13 __cpp_hex_float 201603 predefined
P0018R3 Lambda Capture of *this by Value as [=,*this] 5.1 __cpp_capture_this ?
__cpp_capture_star_this ?
201603 predefined
P0170R1 Wording for Constexpr Lambda 5.1 __cpp_constexpr 201603 predefined
P0184R0 Generalizing the Range-Based For Loop 6.5 __cpp_range_based_for 201603 predefined
P0188R1 Wording for [[fallthrough]] attribute 7.6 __has_cpp_attribute(fallthrough) 201603 predefined
P0189R1 Wording for [[nodiscard]] attribute 7.6 __has_cpp_attribute(nodiscard) 201603 predefined
P0212R1 Wording for [[maybe_unused]] attribute 7.6 __has_cpp_attribute(maybe_unused) 201603 predefined
P0017R1 Extension to aggregate initialization 8.5 __cpp_aggregate_bases 201603 predefined
P0138R2 Construction Rules for enum class Values 8.5 none ?
P0036R0 Unary Folds and Empty Parameter Packs 14.5 __cpp_fold_expressions 201603 predefined
P0154R1 constexpr std::hardware_{constructive,destructive}_interference_size 18.6 __cpp_lib_hardware_interference_size 201603 <new>
LWG2296 std::addressof should be constexpr 20.7 __cpp_lib_addressof_constexpr ? 201603 <memory>
P0033R1 Re-enabling shared_from_this 20.8 __cpp_lib_enable_shared_from_this 201603 <memory>
P0005R4 Adopt not_fn from Library Fundamentals 2 for C++17 20.9 __cpp_lib_not_fn 201603 <function>
P0253R1 Fixing a design mistake in the searchers interface in Library Fundamentals 20.9 none
P0185R1 Adding [nothrow-]swappable traits 20.10 __cpp_lib_is_swappable 201603 <type_traits>
P0077R2 is_callable, the missing INVOKE related trait 20.10 __cpp_lib_is_callable 201603 <type_traits>
P0220R1 Adopt Library Fundamentals V1 TS Components for C++17 20.4 __cpp_lib_apply 201603 <tuple>
20.8 __cpp_lib_shared_ptr_arrays 201603 <memory>
20.9 __cpp_lib_boyer_moore_searching 201603 <functional>
20 __has_include(<optional>)
__has_include(<any>)
__has_include(<string_view>)
__has_include(<memory_resource>)
1 predefined
P0272R1 Give 'std::string' a non-const '.data()' member function 21.4 none ?
P0031R0 A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access 24.3 __cpp_lib_array_constexpr 201603 <iterator>
P0025R0 An algorithm to "clamp" a value between a pair of boundary values 25.4 __cpp_lib_clamp 201603 <algorithm>
P0024R2 The Parallelism TS Should be Standardized 25, 26 __cpp_lib_parallel_algorithm 201603 <algorithm> <numeric>
18 __has_include(<exception_list>) 1 predefined
20 __has_include(<execution_policy>) 1 predefined
P0030R1 Proposal to Introduce a 3-Argument Overload to std::hypot 26.8 __cpp_lib_hypot 201603 <cmath>
P0226R1 Mathematical Special Functions for C++17 26.8 __cpp_lib_math_special_functions 201603 <cmath>
P0218R1 Adopt the File System TS for C++17 27.10 __has_include(<filesystem>) 1 predefined
__cpp_lib_filesystem 201603 <filesystem>
P0152R1 constexpr atomic<T>::is_always_lock_free 29.5 __cpp_lib_atomic_is_always_lock_free 201603 <atomic>

P0005R4: Adopt not_fn from Library Fundamentals 2 for C++17

P0017R1: Extension to aggregate initialization

P0018R3: Lambda Capture of *this by Value as [=,*this]

P0024R2: The Parallelism TS Should be Standardized

P0025R0: An algorithm to "clamp" a value between a pair of boundary values

P0030R1: Proposal to Introduce a 3-Argument Overload to std::hypot

P0031R0: A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access

P0033R1: Re-enabling shared_from_this

P0036R0: Unary Folds and Empty Parameter Packs

P0077R2: is_callable, the missing INVOKE related trait

P0138R2: Construction Rules for enum class Values

This doesn't provide any new functionality; it just makes some kinds of code simpler to write. Code that needs to be portable to implementations lacking this feature would be still more complicated if it tried to use the new feature when available. So a macro for this feature would not seem to be justified.

P0152R1: constexpr atomic<T>::is_always_lock_free

P0154R1: constexpr std::hardware_{constructive,destructive}_interference_size

P0170R1: Wording for Constexpr Lambda

P0184R0: Generalizing the Range-Based For Loop

P0185R0: Adding [nothrow-]swappable traits

Many thanks to Daniel for sending me this example – unsolicited!

Example:

template<class T>
  void my_swap(T& x, T& y)
#if __cpp_lib_is_swappable
  noexcept(std::is_swappable_v<T>); // Covers all Lvalue Swappable cases
#else
  noexcept(
    std::is_nothrow_move_constructible_v<T> &&
    std::is_nothrow_move_assignable_v<T>
  );
#endif

P0188R1: Wording for [[fallthrough]] attribute

P0189R1: Wording for [[nodiscard]] attribute

P0212R1: Wording for [[maybe_unused]] attribute

P0218R1: Adopt the File System TS for C++17

P0220R1: Adopt Library Fundamentals V1 TS Components for C++17

The fundamentals TS proposed a macro for each added component declared in a new header, but the parallelism TS added new headers, with only a single over-arching macro. Requiring a version-test macro for every brand-new header seems to be a bit excessive.

This probably doesn't belong here long-term; it's just for short-term confirmation. Omitted:

P0226R1: Mathematical Special Functions for C++17

P0235R1: Fixing a design mistake in the searchers interface in Library Fundamentals

This is a fix that is applied to the searchers interface at the same time that it is incorporated into the standard. The unfixed state exists only in the TS, which has its own macro name and value. The new macro for the searchers interface in the standard, with its new value, will be enough to indicate that this fix is applied.

P0245R1: Hexadecimal floating literals for C++

P0272R1: Give 'std::string' a non-const '.data()' member function

This doesn't provide any new functionality; it just makes some kinds of code simpler to write. Code that needs to be portable to implementations lacking this feature would be still more complicated if it tried to use the new feature when available. So a macro for this feature would not seem to be justified.

LWG2296: std::addressof should be constexpr

Example:

struct optional {
  bool b;
  T t;
  constexpr T *get() {
    return b ?
#if __cpp_lib_addressof_constexpr
      std::addressof(t)
#else
      &t
#endif
      : nullptr;
  }
};

It is more important for get to be constexpr than for it to work if there is an overloaded operator&, so addressof is used only if it would actually work in a constant expression.