#
The indirectly_writable concept specifies the requirements for writing a value into an iterator's referenced object.
template<class Out, class T> concept indirectly_writable = requires(Out&& o, T&& t) { *o = std::forward<T>(t); / not required to be equality-preserving *std::forward<Out>(o) = std::forward<T>(t); / not required to be equality-preserving const_cast<const iter_reference_t<Out>&>(*o) = std::forward<T>(t); / not required to be equality-preserving const_cast<const iter_reference_t<Out>&>(*std::forward<Out>(o)) = std::forward<T>(t); / not required to be equality-preserving };
2
#
Let E be an expression such that decltype(E)) is T, and let o be a dereferenceable object of type Out.
Out and T model indirectly_writable<Out, T> only if:
  • If Out and T model indirectly_readable<Out> && same_as<iter_value_t<Out>, decay_t<T>>, then *o after any above assignment is equal to the value of E before the assignment.
If E is an xvalue ([basic.lval]), the resulting state of the object it denotes is valid but unspecified ([lib.types.movedfrom]).
[Note 2: 
indirectly_writable has the awkward const_cast expressions to reject iterators with prvalue non-proxy reference types that permit rvalue assignment but do not also permit const rvalue assignment.
Consequently, an iterator type I that returns std​::​string by value does not model indirectly_writable<I, std​::​string>.
— end note]

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant