Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_stringbuf<CharT,Traits,Allocator>::view

      From cppreference.com
      <cpp‎ |io‎ |basic stringbuf
       
       
       
       
      std::basic_string_view<CharT, Traits> view()constnoexcept;
      (since C++20)

      Creates and returns astd::basic_string_view over the underlying character sequence.

      • For input-only streams, the returned view represents the range[eback(), egptr()).
      • For input/output or output-only streams, references the characters frompbase() to the last character in the sequence regardless ofegptr() andepptr().
      • If the stream is neither input nor output, returnsstd::basic_string_view<CharT, Traits>{}.

      The member character sequence in a buffer open for writing can be over-allocated for efficiency purposes. In that case, only theinitialized characters are referenced: these characters are the ones that were obtained from the string argument of the constructor, the string argument used by the most recent call to a setter overload ofstr(), or from a write operation. A typical implementation that uses over-allocation maintains a high-watermark pointer to track the end of the initialized part of the buffer and the returned view references the characters frompbase() to the high-watermark pointer.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      A view over the underlying character sequence.

      [edit]Notes

      Using of the return value is undefined behavior if the underlying character sequence is destroyed or invalidated, unless the return value is empty.

      This function is typically accessed throughstd::basic_istringstream::view(),std::basic_ostringstream::view(), orstd::basic_stringstream::view().

      [edit]See also

      replaces or obtains a copy of the associated character string
      (public member function)[edit]
      returns a non-modifiablebasic_string_view into the entire string
      (public member function ofstd::basic_string<CharT,Traits,Allocator>)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_stringbuf/view&oldid=179826"

      [8]ページ先頭

      ©2009-2025 Movatter.jp