std::enable...k_from_this(3)
okay bestie, you're reading the std::enable...k_from_this(3) page from the C++ Standard Libary manual. grab a strawberry π and let's get into it.
πΈ NAME πΈ
std::enable_shared_from_this::weak_from_this - std::enable_shared_from_this::weak_from_this
yes, it really lists it twice, and we are not erasing a single crumb. π
β¨ Synopsis β¨
std::weak_ptr<T> weak_from_this() noexcept; (1) (since C++17)
std::weak_ptr<T const> weak_from_this() const noexcept; (2) (since C++17)
so what does it do? it returns a std::weak_ptr<T> that tracks ownership of *this by all existing std::shared_ptr that refer to *this. iconic behavior, honestly. β¨
π Return value π
a std::weak_ptr<T> that shares ownership of *this with pre-existing std::shared_ptrs. periodt. π«Ά
π§ Notes π§
weak_from_this copies the exposition only weak_ptr member that is part of enable_shared_from_this.
feature-test macro tea β:
- Feature-test macro:
__cpp_lib_enable_shared_from_this - Value:
201603L - Std:
(C++17) - Feature:
std::enable_shared_from_this::weak_from_this
π¦ Example π¦
This section is incomplete Reason: no example
ngl bestie, that's all it says β no example here. π
π See also π
shared_ptrβ smart pointer with shared object ownership semantics (C++11) (class template)
π Category π
Todo no example
mwah π this page came from http://cppreference.com, date 2024.06.10, and the page name is std::enable...k_from_this(3) β slay and bye π«Ά
π¦ 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