Defined in header <string_view> | ||
---|---|---|
template <class CharT, class Traits> std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, std::basic_string_view <CharT, Traits> v); | (since C++17) |
Behaves as a FormattedOutputFunction. After constructing and checking the sentry object, determines the output format padding as follows:
v.size()
is not less than os.width()
, uses the range [v.begin(), v.end())
as-is (os.flags() & ios_base::adjustfield) == ios_base::left
, places os.width()-v.size()
copies of the os.fill()
character after the character sequence os.width()-v.size()
copies of the os.fill()
character before the character sequence Then stores each character from the resulting sequence (the contents of v
plus padding) to the output stream os
as if by calling os.rdbuf()->sputn(seq, n)
, where n=std::max(os.width(), str.size())
.
Finally, calls os.width(0)
to cancel the effects of std::setw
, if any.
May throw std::ios_base::failure
if an exception is thrown during output.
os | - | a character output stream |
v | - | the view to be inserted |
os
.
performs stream input and output on strings (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/string/basic_string_view/operator_ltlt