Doc. no.: P0220R1
Date: 2016-03-03
Reply to: Beman Dawes <bdawes at acm dot org>, Alisdair Meredith <[email protected]>
Audience: Library, Library Evolution

Adopt Library Fundamentals V1 TS Components for C++17 (R1)

There are currently several proposals in flight to adopt portions of the Library Fundamentals Technical Specification for C++17.

The difficulty of such a piecemeal approach is twofold. It adds a lot of unnecessary overhead to process many proposals rather than a single proposal. It may cause useful but unexciting components to get dropped on the floor because no one notices or because no one is willing to go through the drudgery of writing yet another proposal and shepherding it through the committee.

This paper proposes that the components of TS 19568, C++ Extensions for Library Fundamentals, listed below be adopted into the C++17 working paper. The list was initialized with all of the components from N4562, the Library Fundamentals DTS, and the LWG/LEWG then struck any components that should not be incorporated directly into C++17. This most recent working paper has identical content to the PDTS, but has a format with HTML anchors that can be directly linked from this paper.

As a follow-up edit, the update to several exisiting C++17 header synopses is provided directly in this paper, to more clearly specify edits for just the new components being incorporated.

Directions to the C++ working paper project editor

Add the components in the above list to the C++ working paper using the content for each component from N4562, the Library Fundamentals DTS. Move this content from the std::experimental::fundamentals_v2 inline namespace to the std namespace. Strike experimental/ from the header names, and any additional #include directives in those header synopses.

Note: Although we are adopting only the specified Library Fundamentals V1 components into the C++ working paper, the wording from those components comes from Library Fundamentals V2 to ensure the wording includes the latest corrections.

In addition, make the following changed to the header synposis clauses for the following standard headers, with wording changes relative to N4567, the current C++17 working draft.

17.6.1.2 Headers [headers]

Add the following new headers to Table 14:

20.4 Tuples [tuple]

20.4.1 In general [tuple.general]

2 Header <tuple> synopsis

namespace std {
  // 20.4.2.9, specialized algorithms:
  template <class... Types>
  void swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(see below);
  // 20.4.2.X, Calling a function with a tuple of arguments
  template <class F, class Tuple>
  constexpr decltype(auto) apply(F&& f, Tuple&& t);
}

20.9 Function objects [function.objects]

2 Header synopsis

namespace std {
  // 20.9.x, Searchers
  template<class ForwardIterator, class BinaryPredicate = equal_to<>>
    class default_searcher;
  template<class RandomAccessIterator,
      class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
      class BinaryPredicate = equal_to<>>
    class boyer_moore_searcher;
  template<class RandomAccessIterator,
      class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
      class BinaryPredicate = equal_to<>>
    class boyer_moore_horspool_searcher;

  template<class ForwardIterator, class BinaryPredicate = equal_to<>>
  default_searcher<ForwardIterator, BinaryPredicate>
  make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
                        BinaryPredicate pred = BinaryPredicate());
  template<class RandomAccessIterator,
     class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
     class BinaryPredicate = equal_to<>>
  boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
  make_boyer_moore_searcher(
      RandomAccessIterator pat_first, RandomAccessIterator pat_last,
      Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
  template<class RandomAccessIterator,
     class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
     class BinaryPredicate = equal_to<>>
  boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
  make_boyer_moore_horspool_searcher(
     RandomAccessIterator pat_first, RandomAccessIterator pat_last,
     Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
}

Add the following new header synopsis, immediately preceding the additions for 8.5 Class memory_resource

20.9.x Polymorphic Memory Resources [memory.polymorphic.resource]

20.9.X.1 Header <memory_resource> synopsis [memory.resource.synop]

namespace std::pmr {
  class memory_resource;
  bool operator==(const memory_resource& a,
                  const memory_resource& b) noexcept;
  bool operator!=(const memory_resource& a,
                  const memory_resource& b) noexcept;
  template <class Tp> class polymorphic_allocator;
  template <class T1, class T2>
  bool operator==(const polymorphic_allocator<T1>& a,
                  const polymorphic_allocator<T2>& b) noexcept;
  template <class T1, class T2>
  bool operator!=(const polymorphic_allocator<T1>& a,
                  const polymorphic_allocator<T2>& b) noexcept;
  // Global memory resources
  memory_resource* new_delete_resource() noexcept;
  memory_resource* null_memory_resource() noexcept;
  // The default memory resource
  memory_resource* set_default_resource(memory_resource* r) noexcept;
  memory_resource* get_default_resource() noexcept;
  // Standard memory resources
  struct pool_options;
  class synchronized_pool_resource;
  class unsynchronized_pool_resource;
  class monotonic_buffer_resource;
} // namespace std::pmr