std::experi..._view::data(3)
πΈ NAME πΈ
So this is the std::experimental::basic_string_view::data page from the C++ Standard Libary manual β yes, the data(3) one β and it's lowkey a tiny but important little function, bestie. π
std::experimental::basic_string_view::data gives you a pointer to the underlying character array.
β¨ Synopsis β¨
constexpr const_pointer data() const noexcept;
This is the library fundamentals TS version. π«Ά
It returns a pointer to the underlying character array. The pointer is such that the range [data(), data() + size()) is valid, and the values in that range correspond to the values of the view. β¨
n.b. Unlikebasic_string::data()and string literals,data()may return a pointer to a buffer that is not null-terminated. So it's typically a mistake to passdata()to a routine that takes just aconst CharT*and expects a null-terminated string. Like, do not do that, bestie. ππ
π Parameters π
(none) β literally no parameters. Zero. Nada. β¨
π Return value π
A pointer to the underlying character array. That's the whole vibe. π
β Complexity β
Constant. No surprises, no drama, just constant. π
π¦ See also π¦
frontβ accesses the first character (public member function)backβ accesses the last character (public member function)
πΈ Category πΈ
Noindexed pages
That's the whole page, bestie β short, sweet, and absolutely iconic. π
Source/version and date sign-off: this one comes from http://cppreference.com, version/date 2024.06.10. Mwah. πβ¨
π¦ 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