operator<<(std::basic_string_view) - cppreference.com (original) (raw)

Behaves as a FormattedOutputFunction. After constructing and checking the sentry object, determines the output format padding.

Then stores each character from the resulting sequence seq (the contents of v with padding) to the output stream os as if by calling os.rdbuf()->sputn(seq, n), where n is std::max(os.width(), str.size()).

Finally, calls os.width(0) to cancel the effects of std::setw, if any.

[edit] Exceptions

May throw std::ios_base::failure if an exception is thrown during output.

[edit] Parameters

os - a character output stream
v - the view to be inserted

[edit] Return value

os

[edit] Example

Output:

[abc--] [abc--] [--abc] [abc]

[edit] See also