std::experi...::operator[](3)
π NAME π
std::experimental::shared_ptr::operator[] - std::experimental::shared_ptr::operator[] π
Okay bestie, this is the std::experi...::operator[](3) page from the C++ Standard Libary manual β yes, βLibaryβ is literally how itβs spelled in the header, and we are not fixing it. This page is all about std::experimental::shared_ptr::operator[], and itβs here to index into an array. π¦
β¨ Synopsis β¨
element_type& operator[]( std::ptrdiff_t i ) const
noexcept;
Tagged (library fundamentals TS), bestie. This operator indexes into the array pointed to by the stored pointer. No cap.
π¨ Behavior check: the behavior is undefined if the stored pointer is null or if i is negative. Like, undefined undefined. Do not test that vibe. π
And if T (the template parameter of shared_ptr) is an array type U[N], then i shall be less than N, or the behavior is undefined. Periodt.
πΈ Parameters πΈ
iβ the array index.
π Return value π
A reference to the i-th element of the array, i.e., get()[i]. Slay. π
π Remarks π
Okay so hereβs the chaotic little caveat: when T is not an array type, it is unspecified whether this function is declared. If the function is declared, it is unspecified what its return type is, except that the declaration (although not necessarily the definition) of the function is guaranteed to be legal. Thatβs the whole rule. Iykyk. π§
π¦ Example π¦
This section is incomplete Reason: no example π
π₯ See also π₯
getβ returns the stored pointer (public member function).
π Categories π
Noindexed pagesTodo no example
Cute little sign-off: this is the std::experi...::operator[](3) page from the C++ Standard Libary, source/version/date http://cppreference.com / 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