std::basic_...buf::seekoff(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::basic_spanbuf::seekoff πŸ’–

okay so this is the C++ Standard Libary manual, section 3, and the whole page is about std::basic_spanbuf::seekoff. bestie, it’s giving protected member function realness, and we’re about to get into pointer-repositioning. periodt. ✨

✨ NAME ✨

std::basic_spanbuf::seekoff β€” std::basic_spanbuf::seekoff

πŸ“œ Synopsis πŸ“œ

          protected:

          pos_type seekoff( off_type off, std::ios_base::seekdir dir,
                            std::ios_base::openmode which =
       (since C++23)

                                std::ios_base::in | std::ios_base::out )
          override;

okay so what does it even do? It repositions the next pointer to get and/or put area, if possible, to the position that corresponds to exactly off characters from beginning, end, or current position of the get and/or put area of the buffer. πŸ’…

Let n be the number of CharT elements in underlying buffer, or 0 when there is no underlying buffer, this function fails if:

  • the next pointer to the get and/or put area to reposition is null and the computed newoff (see below) is not zero, which may occur if there is no underlying buffer, or the *this is not opened in the mode required by which, or
  • dir is std::ios_base::cur and both std::ios_base::in and std::ios_base::out are set in which, or
  • the computed newoff is not representable in off_type, less than zero, or greater than n.

newoff is computed as below:

  • If dir is std::ios_base::beg, newoff is off.
  • If dir is std::ios_base::cur, newoff is:
    • pptr() - pbase() + off if std::ios_base::out is set in which, or
    • gptr() - eback() + off if std::ios_base::in is set in which.
  • If dir is std::ios_base::end, newoff is:
    • pptr() - pbase() + off if std::ios_base::out but not std::ios_base::in is set in the open mode of *this,
    • otherwise, off + n.

This function repositions the next pointer to get and/or put area to pbuf + newoff on success if std::ios_base::in and/or std::ios_base::out is correspondingly set in which, where pbuf is the pointer to the beginning of the underlying buffer, or the null pointer value if there is no underlying buffer.

πŸŽ€ Parameters πŸŽ€

  • off β€” relative position to set the next pointer(s) to.
  • dir β€” defines base position to apply the relative offset to. It can be one of the following constants:
    • beg β€” the beginning of a stream
    • end β€” the ending of a stream
    • cur β€” the current position of stream position indicator
  • which β€” defines whether the input sequences, the output sequence, or both are affected. It can be one or a combination of the following constants:
    • in β€” affect the input sequence
    • out β€” affect the output sequence

🌈 Return value 🌈

pos_type(newoff) on success, pos_type(off_type(-1)) on failure.

🌸 Example 🌸

This section is incomplete.

Reason: no example.

bestie, the example section really said β€œnot today” 😭 no example means no example, and we respect the iconique incompleteness.

πŸ¦‹ See also πŸ¦‹

  • seekoff β€” repositions the next pointer in the input sequence, output sequence, or both, using relative addressing [virtual] (virtual protected member function of std::basic_stringbuf<CharT,Traits,Allocator>)
  • seekoff β€” repositions the next pointer in the input sequence, output sequence, or both, using relative addressing [virtual] (virtual protected member function of std::strstreambuf)

πŸ‘‘ Category πŸ‘‘

  • Todo no example

source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::basic_...buf::seekoff(3) β€” slay and goodbye, bestie πŸ’‹πŸ’–

πŸ“¦ where this page comes from