std::basic_...tream::view(3)
π std::basic_...tream::view(3) π
πΈ NAME πΈ
okay bestie, this is the C++ Standard Libary page for std::basic_ostringstream::view β and the NAME line is literally std::basic_ostringstream::view - std::basic_ostringstream::view. π
β¨ Synopsis β¨
std::basic_string_view<CharT, Traits> view() const noexcept; (since
C++20)
Obtains a std::basic_string_view over the underlying string object. Equivalent to:
return rdbuf()->view();
π Parameters π
(none) β no parameters, she takes zero notes. π«Ά
π Return value π
A std::basic_string_view over the underlying string object. periodt. β¨
π₯ Example π₯
// Run this code
#include <iostream>
#include <sstream>
int main()
{
// input/output stream
std::stringstream buf1;
buf1 << 69;
int n = 0;
buf1 >> n;
std::cout << "1) buf1 = [" << buf1.view() << "], n = " << n <<
'\n';
// output stream in append mode
std::ostringstream buf2("test", std::ios_base::ate);
buf2 << '1';
std::cout << "2) buf2 = [" << buf2.view() << "]\n";
// input stream
std::istringstream inbuf("-42");
inbuf >> n;
std::cout << "3) inbuf = [" << inbuf.view() << "], n = " << n <<
'\n';
}
π Output: π
1) buf1 = [69], n = 69
2) buf2 = [test1]
3) inbuf = [-42], n = -42
π See also π
viewβ obtains a view over the underlying character sequence (C++20) (public member function ofstd::basic_stringbuf<CharT,Traits,Allocator>)
signing off with source/version/date energy: sourced from http://cppreference.com, dated 2024.06.10 π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms