std::experimental::ranges::Writable

From cppreference.com
< cpp‎ | experimental‎ | ranges
Experimental
Technical Specification
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Experimental Non-TS
Pattern Matching
Linear Algebra
std::execution
Contracts
2D Graphics
template < class Out, class T >

concept bool Writable =
    requires(Out&& o, T&& t) {
*o = std::forward <T> (t) ;
* std::forward <Out> (o) = std::forward <T> (t) ;
const_cast < const ranges:: reference_t <Out> && > ( *o) =
std::forward <T> (t) ;
const_cast < const ranges:: reference_t <Out> && > ( * std::forward <Out> (o) ) =
std::forward <T> (t) ;
} ;

/* none of the four expressions above are required to be equality-preserving */
(ranges TS)

The concept Writable<Out, T> specifies the requirements for writing a value whose type and value category are encoded by T into an iterator Out's referenced object.

Let E be an expression such that decltype((E)) is T, and o be a dereferenceable object of type Out, then Writable<Out, T>

  • If Readable<Out> && Same<ranges:: value_type_t <Out>, std::decay_t <T>> is satisfied, then *o after any above assignment is equal to the value of E

o is not required to be dereferenceable after evaluating any of the assignment expressions above. If E

Equality preservation

An expression is equality preserving if it results in equal outputs given equal inputs.

  • The inputs to an expression consist of its operands.
  • The outputs of an expression consist of its result and all operands modified by the expression (if any).

Every expression required to be equality preserving is further required to be stable

Notes

The only valid use of operator*

The required expressions with const_cast prevent Readable objects with prvalue reference types from satisfying the syntactic requirements of Writable by accident, while permitting proxy references to continue to work as long as their constness is shallow. See Ranges TS issue 381