Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::ranges::Writable

      From cppreference.com
      <cpp‎ |experimental‎ |ranges
       
       
       
       
      Iterators library
      Iterator concepts
      Indirect callable concepts
                                                        
                                                        
                                                        
      Common algorithm requirements
                                                        
      Concept utilities
      Iterator utilities and operations
      Iterator traits
      Iterator adaptors
      Stream iterators
       
      template<class Out,class T>

      conceptbool 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 conceptWritable<Out, T> specifies the requirements for writing a value whose type and value category are encoded byT into an iteratorOut's referenced object.

      LetE be an expression such thatdecltype((E)) isT, ando be a dereferenceable object of typeOut, thenWritable<Out, T> is satisfied only if:

      • IfReadable<Out>&& Same<ranges::value_type_t<Out>,std::decay_t<T>> is satisfied, then*o after any above assignment is equal to the value ofE before the assignment.

      o is not required to be dereferenceable after evaluating any of the assignment expressions above. IfE is an xvalue, the resulting state of the object it denotes is valid but unspecified.

      [edit] Equality preservation

      An expression isequality 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 bestable: two evaluations of such an expression with the same input objects must have equal outputs absent any explicit intervening modification of those input objects.

      [edit]Notes

      The only valid use ofoperator* is on the left side of an assignment expression. Assignment through the same value of a writable type may happen only once.

      The required expressions withconst_cast preventReadable objects with prvaluereference types from satisfying the syntactic requirements ofWritable by accident, while permitting proxy references to continue to work as long as their constness is shallow. SeeRanges TS issue 381.

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/ranges/iterator/Writable&oldid=155653"

      [8]ページ先頭

      ©2009-2026 Movatter.jp