23 Iterators library [iterators]

23.5 Iterator adaptors [predef.iterators]

23.5.4 Common iterators [iterators.common] Accessors [common.iter.access]

decltype(auto) operator*(); decltype(auto) operator*() const requires dereferenceable<const I>;
Preconditions: holds_­alternative<I>(v_­).
Effects: Equivalent to: return *get<I>(v_­);
decltype(auto) operator->() const requires see below;
The expression in the requires-clause is equivalent to: indirectly_­readable<const I> && (requires(const I& i) { i.operator->(); } || is_reference_v<iter_reference_t<I>> || constructible_­from<iter_value_t<I>, iter_reference_t<I>>)
Preconditions: holds_­alternative<I>(v_­).
  • If I is a pointer type or if the expression get<I>(v_­).operator->() is well-formed, equivalent to: return get<I>(v_­);
  • Otherwise, if iter_­reference_­t<I> is a reference type, equivalent to: auto&& tmp = *get<I>(v_); return addressof(tmp);
  • Otherwise, equivalent to: return proxy(*get<I>(v_­)); where proxy is the exposition-only class: class proxy { iter_value_t<I> keep_; proxy(iter_reference_t<I>&& x) : keep_(std::move(x)) {} public: const iter_value_t<I>* operator->() const { return addressof(keep_); } };