Document Number:N4270
Date:
Revises:N4081
Author: Alisdair Meredith
Bloomberg LP
ameredith1@bloomberg.net

Consolidated Revisions to C++ Extensions for Library Fundamentals

4

Function objects

[func]
4.2

Class template function

[func.wrap.func]
4.2.2

function modifiers

[func.wrap.func.mod]
void swap(function& other);
Requires:
this->get_memory_resource() == other->get_memory_resource().
Effects:
Interchanges the targets of *this and other.
Remark:
The allocators of *this and other are not interchanged.
4.3

Searchers

[func.searchers]

The Boyer-Moore searcher implements the Boyer-Moore search algorithm. The Boyer-Moore-Horspool searcher implements theBoyer-Moore-Horspool search algorithm. In general, the Boyer-Moore searcher will use more memory and give better run-time performance than Boyer-Moore-Horspool.

4.3.2

Class template boyer_moore_searcher

[func.searchers.boyer_moore]
boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
Hash hf = Hash(),
BinaryPredicate pred = BinaryPredicate());
Throws:
Any exception thrown by the copy constructor of BinaryPredicate or RandomAccessIterator1, or by the default constructor, copy constructor, or the copy assignment operator of the value type of RandomAccessIterator1, or the copy constructor or operator() of BinaryPredicate or Hash. May throw bad_alloc if cannot allocate additional memory for internal data structures needed.
4.3.3

Class template boyer_moore_horspool_searcher

[func.searchers.boyer_moore_horspool]

template<class RandomAccessIterator1,
         class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
         class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher {
public:
  boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
                                Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());

  template<class RandomAccessIterator2>
  RandomAccessIterator2
  operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;

private:
  RandomAccessIterator1 pat_first_; // exposition only
  RandomAccessIterator1 pat_last_;  // exposition only
  Hash                  hash_;      // exposition only
  BinaryPredicate       pred_;      // exposition only
};
boyer_moore_horspool_searcher(
RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
Throws:
Any exception thrown by the copy constructor of BinaryPredicate or RandomAccessIterator1, or by the default constructor, copy constructor, or the copy assignment operator of the value type of RandomAccessIterator1 or the copy constructor or operator() of BinaryPredicate or Hash. May throw bad_alloc if the system cannot allocate additional memory for internal data structures needed.
5

Optional objects

[optional]
5.3

optional for object types

[optional.object]
template <class T>
class optional
{

  // 5.3.5, Observers
  constexpr T const* operator ->() const;
  constexpr T* operator ->();
  constexpr T const& operator *() const &;
  constexpr T& operator *() &;
  constexpr T&& operator *() &&;
  constexpr const T&& operator *() const &&;
  constexpr explicit operator bool() const noexcept;
  constexpr T const& value() const &;
  constexpr T& value() &;
  constexpr T&& value() &&;
  constexpr const T&& value() const &&;
  template <class U> constexpr T value_or(U&&) const &;
  template <class U> constexpr T value_or(U&&) &&;

};
5.3.5

Observers

[optional.object.observe]
constexpr T&& operator*() &&;constexpr const T&& operator*() const &&;
Requires:
*this contains a value
Effects:
Equivalent to return std::move(*val);
Remarks:
If is_move_constructible_v<T> is false, the program is ill-formed.
constexpr explicit operator bool() const noexcept;
constexpr T&& value() &&;constexpr const T&& value() const &&;
Effects:
Equivalent to return bool(*this) ? std::move(*val) : throw bad_optional_access();
Remarks:
If is_move_constructible_v<T> is false, the program is ill-formed.
6

Class any

[any]
6.1

Header <experimental/any> synopsis

[any.synop]
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {

  class any
  {
  public:
    // 6.3.1, any construct/destruct

    template <class Allocator>
      any(allocator_arg_t, const Allocator& a) noexcept;
    template <class Allocator, class ValueType>
      any(allocator_arg_t, const Allocator& a, ValueType&& value);
    template <class Allocator>
        any(allocator_arg_t, const Allocator& a, const any& other);
    template <class Allocator>
        any(allocator_arg_t, const Allocator& a, any&& other) noexcept;

  };

} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
6.3

Class any

[any.class]

Implementations should avoid the use of dynamically allocated memory for a small contained object. [ Example: where the object constructed is holding only an int. end example ] Such small-object optimization shall only be applied to nothrow copyable typestypes T for which is_nothrow_move_constructible_v<T> is true.

6.3.1

any construct/destruct

[any.cons]
any(const any& other);
Throws:
Any exceptions arising from calling the copyselected constructor of the contained object.
template <class Allocator>
any(allocator_arg_t, const Allocator& a) noexcept;template <class Allocator, class ValueType>
any(allocator_arg_t, const Allocator& a, ValueType&& value);template <class Allocator>
any(allocator_arg_t, const Allocator& a, const any& other);template <class Allocator>
any(allocator_arg_t, const Allocator& a, any&& other) noexcept;
Requires:
Allocator shall meet the requirements for an Allocator (C++14 §17.6.3.5).
Effects:
Equivalent to the preceding constructors except that the contained object is constructed with uses-allocator construction (C++14 §20.7.7.2) if memory allocation is performed.