C++ åèæå
- C++11
- C++14
- C++17
- C++20
- C++ ç¼è¯å¨æ¯ææ åµè¡¨
- ç¬ç«ä¸å®¿ä¸»å®ç°
- C++ è¯è¨
- C++ å ³é®è¯
- é¢å¤çå¨
- C++ æ ååºå¤´æä»¶
- æ ååºå¤´æä»¶ <ctime>
- æ ååºå¤´æä»¶ <cstring>
- æ ååºå¤´æä»¶ <set>
- æ ååºå¤´æä»¶ <cctype>
- æ ååºå¤´æä»¶ <cwctype>
- æ ååºå¤´æä»¶ <utility>
- æ ååºå¤´æä»¶ <queue>
- æ ååºå¤´æä»¶ <complex>
- æ ååºå¤´æä»¶ <iterator>
- æ ååºå¤´æä»¶ <algorithm>
- æ ååºå¤´æä»¶ <valarray>
- æ ååºå¤´æä»¶ <numeric>
- æ ååºå¤´æä»¶ <cmath>
- æ ååºå¤´æä»¶ <iosfwd>
- æ ååºå¤´æä»¶ <ios>
- æ ååºå¤´æä»¶ <iomanip>
- æ ååºå¤´æä»¶ <streambuf>
- æ ååºå¤´æä»¶ <istream>
- æ ååºå¤´æä»¶ <ostream>
- æ ååºå¤´æä»¶ <iostream>
- æ ååºå¤´æä»¶ <sstream>
- æ ååºå¤´æä»¶ <clocale>
- æ ååºå¤´æä»¶ <vector>
- æ ååºå¤´æä»¶ <deque>
- æ ååºå¤´æä»¶ <list>
- æ ååºå¤´æä»¶ <map>
- æ ååºå¤´æä»¶ <cwchar>
- æ ååºå¤´æä»¶ <locale>
- æ ååºå¤´æä»¶ <codecvt>
- æ ååºå¤´æä»¶ <bitset>
- æ ååºå¤´æä»¶ <functional>
- æ ååºå¤´æä»¶ <stdexcept>
- æ ååºå¤´æä»¶ <csignal>
- æ ååºå¤´æä»¶ <csetjmp>
- æ ååºå¤´æä»¶ <stack>
- æ ååºå¤´æä»¶ <cassert>
- æ ååºå¤´æä»¶ <cerrno>
- æ ååºå¤´æä»¶ <memory>
- æ ååºå¤´æä»¶ <typeindex>
- æ ååºå¤´æä»¶ <type_traits>
- æ ååºå¤´æä»¶ <chrono>
- æ ååºå¤´æä»¶ <initializer_list>
- æ ååºå¤´æä»¶ <tuple>
- æ ååºå¤´æä»¶ <scoped_allocator>
- æ ååºå¤´æä»¶ <cstdint>
- æ ååºå¤´æä»¶ <cinttypes>
- æ ååºå¤´æä»¶ <system_error>
- æ ååºå¤´æä»¶ <cuchar>
- æ ååºå¤´æä»¶ <array>
- æ ååºå¤´æä»¶ <forward_list>
- æ ååºå¤´æä»¶ <unordered_set>
- æ ååºå¤´æä»¶ <unordered_map>
- æ ååºå¤´æä»¶ <random>
- æ ååºå¤´æä»¶ <ratio>
- æ ååºå¤´æä»¶ <cfenv>
- æ ååºå¤´æä»¶ <regex>
- æ ååºå¤´æä»¶ <atomic>
- æ ååºå¤´æä»¶ <thread>
- æ ååºå¤´æä»¶ <mutex>
- æ ååºå¤´æä»¶ <future>
- æ ååºå¤´æä»¶ <condition_variable>
- æ ååºå¤´æä»¶ <any>
- æ ååºå¤´æä»¶ <optional>
- æ ååºå¤´æä»¶ <variant>
- æ ååºå¤´æä»¶ <memory_resource>
- æ ååºå¤´æä»¶ <string_view>
- æ ååºå¤´æä»¶ <charconv>
- æ ååºå¤´æä»¶ <execution>
- æ ååºå¤´æä»¶ <filesystem>
- æ ååºå¤´æä»¶ <concepts>
- æ ååºå¤´æä»¶ <coroutine>
- æ ååºå¤´æä»¶ <compare>
- æ ååºå¤´æä»¶ <version>
- æ ååºå¤´æä»¶ <source_location>
- æ ååºå¤´æä»¶ <format>
- æ ååºå¤´æä»¶ <span>
- æ ååºå¤´æä»¶ <ranges>
- æ ååºå¤´æä»¶ <bit>
- æ ååºå¤´æä»¶ <numbers>
- æ ååºå¤´æä»¶ <syncstream>
- æ ååºå¤´æä»¶ <stop_token>
- æ ååºå¤´æä»¶ <semaphore>
- æ ååºå¤´æä»¶ <latch>
- æ ååºå¤´æä»¶ <barrier>
- æ ååºå¤´æä»¶ <string>
- æ ååºå¤´æä»¶ <cstddef>
- æ ååºå¤´æä»¶ <limits>
- æ ååºå¤´æä»¶ <cfloat>
- æ ååºå¤´æä»¶ <climits>
- æ ååºå¤´æä»¶ <cstdlib>
- æ ååºå¤´æä»¶ <new>
- æ ååºå¤´æä»¶ <typeinfo>
- æ ååºå¤´æä»¶ <exception>
- æ ååºå¤´æä»¶ <cstdarg>
- æ ååºå¤´æä»¶ <ciso646>
- æ ååºå¤´æä»¶ <cstdalign>
- æ ååºå¤´æä»¶ <cstdbool>
- æ ååºå¤´æä»¶ <fstream>
- æ ååºå¤´æä»¶ <cstdio>
- æ ååºå¤´æä»¶ <strstream>
- æ ååºå¤´æä»¶ <shared_mutex>
- æ ååºå¤´æä»¶ <ccomplex>
- æ ååºå¤´æä»¶ <ctgmath>
- 注é
- å ·åè¦æ±
- åè½ç¹æ§æµè¯ (C++20)
- å·¥å ·åº
- ç±»åæ¯æï¼åºæ¬ç±»åãRTTIãç±»åç¹æ§ï¼
- æ¦å¿µåº (C++20)
- é误å¤ç
- 卿å å管ç
- æ¥æåæ¶é´å·¥å ·
- å符串åº
- 容å¨åº
- è¿ä»£å¨åº
- èå´åº (C++20)
- ç®æ³åº
- æ°å¼åº
- è¾å ¥/è¾åºåº
- æä»¶ç³»ç»åº
- æ¬å°ååº
- æ£å表达å¼åº
- ååæä½åº
- çº¿ç¨æ¯æåº
- å®éªæ§ C++ ç¹æ§
- æç¨çèµæº
- ç´¢å¼
- std 符å·ç´¢å¼
- åç¨æ¯æ (C++20)
- C++ å ³é®è¯
ä½ç½®ï¼é¦é¡µ > C++ åèæå >C++ æ ååºå¤´æä»¶ > æ ååºå¤´æä»¶ <memory>
æ ååºå¤´æä»¶ <memory>
æ¤å¤´æä»¶æ¯å¨æå å管çåºçä¸é¨åã
ç±» | |
æéç¹å¾ | |
| (C++11) |
æä¾å
³äºæéå¼ç±»åçä¿¡æ¯ (类模æ¿) |
å徿¶é卿¯æ | |
| (C++11) |
ååºæéå®å
¨æ¨¡å¼ (æä¸¾) |
åé å¨ | |
| é»è®¤çåé
å¨ (类模æ¿) | |
| (C++11) |
æä¾å
³äºåé
å¨ç±»åçä¿¡æ¯ (类模æ¿) |
| (C++11) |
æ ç¾ç±»åï¼ç¨äºéæ©å
·åé
å¨çæé 彿°éè½½ (ç±») |
| (C++11) |
ç¨äºéæ©å
·åé
å¨çæé 彿°ç std::allocator_arg_t 对象 (常é) |
| (C++11) |
æ£æ¥æå®çç±»åæ¯å¦æ¯æä½¿ç¨åé
å¨çæé (类模æ¿) |
æªåå§ååå¨ | |
| (C++17 ä¸å¼ç¨)(C++20 ä¸ç§»é¤) |
å
许æ åç®æ³åå¨ç»æäºæªåå§åå
åçè¿ä»£å¨ (类模æ¿) |
æºè½æé | |
| (C++11) |
æ¥æç¬æå¯¹è±¡æææè¯ä¹çæºè½æé (类模æ¿) |
| (C++11) |
æ¥æå
±äº«å¯¹è±¡æææè¯ä¹çæºè½æé (类模æ¿) |
| (C++11) |
å° std::shared_ptr æç®¡ç对象çå¼±å¼ç¨ (类模æ¿) |
| (C++17 ä¸ç§»é¤) |
æ¥æä¸¥æ ¼å¯¹è±¡æææè¯ä¹çæºè½æé (类模æ¿) |
è¾ å©ç±» | |
| (C++20) |
ååå
±äº«æé (类模æ¿ç¹å) |
| (C++20) |
ååå¼±æé (类模æ¿ç¹å) |
| (C++11) |
æä¾åºäºææè
çï¼å
±äº«æéåå¼±æéçæ··åç±»åçæåº (类模æ¿) |
| (C++11) |
å
许对象å建æä»£èªèº«ç shared_ptr (类模æ¿) |
| (C++11) |
è®¿é®æåå·²éæ¯å¯¹è±¡ç weak_ptr æ¶æåºçå¼å¸¸ (ç±») |
| (C++11) |
unique_ptr çé»è®¤å é¤å¨ (类模æ¿) |
| (C++11) |
std::unique_ptr çæ£åæ¯æ (类模æ¿ç¹å) |
| (C++11) |
std::shared_ptr çæ£åæ¯æ (类模æ¿ç¹å) |
彿° | |
æé¡¹ | |
| (C++20) |
仿éå¼ç±»åè·å¾è£¸æé (彿°æ¨¡æ¿) |
| (C++11) |
è·å¾å¯¹è±¡çå®é
å°åï¼å³ä½¿å
¶éè½½äº & è¿ç®ç¬¦ (彿°æ¨¡æ¿) |
| (C++11) |
对é½ç¼å²åºä¸çæé (彿°) |
| (C++20) |
åç¥ç¼è¯å¨æéå·²å¯¹é½ (彿°æ¨¡æ¿) |
å徿¶é卿¯æ | |
| (C++11) |
声æä¸ä¸ªå¯¹è±¡ä¸è½è¢«åæ¶ (彿°) |
| (C++11) |
声æä¸ä¸ªå¯¹è±¡å¯ä»¥è¢«åæ¶ (彿°æ¨¡æ¿) |
| (C++11) |
声æè¯¥å
ååºåä¸å«å¯è¿½è¸ªæé (彿°) |
| (C++11) |
åæ¶ std::declare_no_pointers çææ (彿°) |
| (C++11) |
è¿åå½åçæéå®å
¨æ¨¡å¼ (彿°) |
æªåå§ååå¨ | |
| å°èå´å
ç对象å¤å¶å°æªåå§åçå
ååºå (彿°æ¨¡æ¿) | |
| (C++11) |
尿宿°éç对象å¤å¶å°æªåå§åçå
ååºå (彿°æ¨¡æ¿) |
| å¤å¶ä¸ä¸ªå¯¹è±¡å°ä»¥èå´å®ä¹çæªåå§åå
ååºå (彿°æ¨¡æ¿) | |
| å¤å¶ä¸ä¸ªå¯¹è±¡å°ä»¥èµ·ç¹å计æ°å®ä¹çæªåå§åå
ååºå (彿°æ¨¡æ¿) | |
| (C++17) |
ç§»å¨ä¸ä¸ªèå´çå¯¹è±¡å°æªåå§åçå
ååºå (彿°æ¨¡æ¿) |
| (C++17) |
ç§»å¨ä¸å®æ°éå¯¹è±¡å°æªåå§åå
ååºå (彿°æ¨¡æ¿) |
| å¨èå´æå®ä¹çæªåå§åçå
ååºå以é»è®¤åå§åæé 对象 (彿°æ¨¡æ¿) | |
| å¨èµ·å§åè®¡æ°æå®ä¹çæªåå§åå
ååºåç¨é»è®¤åå§åæé 对象 (彿°æ¨¡æ¿) | |
| å¨èå´æå®ä¹çæªåå§åå
åä¸ç¨å¼åå§åæé 对象 (彿°æ¨¡æ¿) | |
| å¨èµ·å§åè®¡æ°æå®ä¹çæªåå§åå
ååºå以å¼åå§åæé 对象 (彿°æ¨¡æ¿) | |
| (C++17) |
鿝å¨ç»å®å°åç对象 (彿°æ¨¡æ¿) |
| (C++17) |
鿝ä¸ä¸ªèå´ä¸ç对象 (彿°æ¨¡æ¿) |
| (C++17) |
鿝èå´ä¸ä¸å®æ°éç对象 (彿°æ¨¡æ¿) |
| (C++17 ä¸å¼ç¨)(C++20 ä¸ç§»é¤) |
è·å¾æªåå§ååå¨ (彿°æ¨¡æ¿) |
| (C++17 ä¸å¼ç¨)(C++20 ä¸ç§»é¤) |
éæ¾æªåå§ååå¨ (彿°æ¨¡æ¿) |
æºè½æééæåæä½ | |
| (C++14)(C++20) |
å建管çä¸ä¸ªæ°å¯¹è±¡çç¬å æé (彿°æ¨¡æ¿) |
| (C++20 ä¸ç§»é¤)(C++20) |
ä¸å¦ä¸ä¸ª unique_ptr æ nullptr è¿è¡æ¯è¾ (彿°æ¨¡æ¿) |
| å建管çä¸ä¸ªæ°å¯¹è±¡çå
±äº«æé (彿°æ¨¡æ¿) | |
| å建管çä¸ä¸ªç¨åé
å¨åé
çæ°å¯¹è±¡çå
±äº«æé (彿°æ¨¡æ¿) | |
| åºç¨ static_castãdynamic_castãconst_cast æ reinterpret_cast å°è¢«å卿é (彿°æ¨¡æ¿) | |
| è¿åæå®ç±»åä¸çå é¤å¨ï¼è¥å
¶æ¥æ (彿°æ¨¡æ¿) | |
| (C++20 ä¸ç§»é¤)(C++20 ä¸ç§»é¤)(C++20 ä¸ç§»é¤)(C++20 ä¸ç§»é¤)(C++20 ä¸ç§»é¤)(C++20) |
ä¸å¦ä¸ä¸ª shared_ptr æ nullptr è¿è¡æ¯è¾ (彿°æ¨¡æ¿) |
| å°åå¨çæéçå¼è¾åºå°è¾åºæµ (彿°æ¨¡æ¿) | |
| (C++11) |
ç¹å std::swap ç®æ³ (彿°æ¨¡æ¿) |
| (C++11) |
ç¹å std::swap ç®æ³ (彿°æ¨¡æ¿) |
| (C++11) |
ç¹å std::swap ç®æ³ (彿°æ¨¡æ¿) |
| ç¹åçååæä½ (彿°æ¨¡æ¿) |
Niebloid | |
| å®ä¹äºå½å空é´
std::ranges | |
æªåå§ååå¨ | |
| (C++20) |
å¤å¶å
ç´ èå´å°æªåå§åçå
ååºå (niebloid) |
| (C++20) |
å¤å¶ä¸å®éå
ç´ å°æªåå§åçå
ååºå (niebloid) |
| (C++20) |
å¤å¶ä¸ä¸ªå¯¹è±¡å°èå´æå®ä¹çæªåå§åçå
ååºå (niebloid) |
| (C++20) |
å¤å¶ä¸ä¸ªå¯¹è±¡å°èµ·å§ä¸è®¡æ°æå®ä¹çæªåå§åçå
ååºå (niebloid) |
| (C++20) |
ç§»å¨å¯¹è±¡èå´å°æªåå§åçå
ååºå (niebloid) |
| (C++20) |
ç§»å¨ä¸å®éå¯¹è±¡å°æªåå§åçå
ååºå (niebloid) |
| å¨èå´æå®ä¹çæªåå§åçå
ååºå以é»è®¤åå§åæé 对象 (niebloid) | |
| å¨èµ·å§ä¸è®¡æ°æå®ä¹çæªåå§åçå
ååºå以é»è®¤åå§åæé 对象 (niebloid) | |
| å¨èå´æå®ä¹çæªåå§åçå
ååºå以å¼åå§åæé 对象 (niebloid) | |
| å¨èµ·å§ä¸è®¡æ°æå®ä¹çæªåå§åçå
ååºå以å¼åå§åæé 对象 (niebloid) | |
| (C++20) |
鿝ä½äºç»å®å°åçå
ç´ (niebloid) |
| (C++20) |
鿝èå´ä¸çå
ç´ (niebloid) |
| (C++20) |
鿝èå´ä¸ä¸å®éçå
ç´ (niebloid) |
æ¦è¦
namespace std { // æéç¹å¾ template<class Ptr> struct pointer_traits; template<class T> struct pointer_traits<T*>;  // æéè½¬æ¢ template<class T> constexpr T* to_address(T* p) noexcept; template<class Ptr> auto to_address(const Ptr& p) noexcept;  // æéå®å ¨ enum class pointer_safety { relaxed, preferred, strict }; void declare_reachable(void* p); template<class T> T* undeclare_reachable(T* p); void declare_no_pointers(char* p, size_t n); void undeclare_no_pointers(char* p, size_t n); pointer_safety get_pointer_safety() noexcept;  // æéå¯¹é½ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); template<size_t N, class T> [[nodiscard]] constexpr T* assume_aligned(T* ptr);  // åé å¨å®åæ ç¾ struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{};  // uses_allocator template<class T, class Alloc> struct uses_allocator;  // uses_allocator template<class T, class Alloc> inline constexpr bool uses_allocator_v = uses_allocator<T, Alloc>::value;  // 使ç¨åé 卿é template<class T, class Alloc, class... Args> constexpr auto uses_allocator_construction_args(const Alloc& alloc, Args&&... args) noexcept -> /* è§å®ä¹ */; template<class T, class Alloc, class Tuple1, class Tuple2> constexpr auto uses_allocator_construction_args( const Alloc& alloc, piecewise_construct_t, Tuple1&& x, Tuple2&& y) noexcept -> /* è§å®ä¹ */; template<class T, class Alloc> constexpr auto uses_allocator_construction_args(const Alloc& alloc) noexcept -> /* è§å®ä¹ */; template<class T, class Alloc, class U, class V> constexpr auto uses_allocator_construction_args(const Alloc& alloc, U&& u, V&& v) noexcept -> /* è§å®ä¹ */; template<class T, class Alloc, class U, class V> constexpr auto uses_allocator_construction_args(const Alloc& alloc, const pair<U,V>& pr) noexcept -> /* è§å®ä¹ */; template<class T, class Alloc, class U, class V> constexpr auto uses_allocator_construction_args(const Alloc& alloc, pair<U,V>&& pr) noexcept -> /* è§å®ä¹ */; template<class T, class Alloc, class... Args> constexpr T make_obj_using_allocator(const Alloc& alloc, Args&&... args);  // åé å¨ç¹å¾ template<class Alloc> struct allocator_traits;  // é»è®¤åé å¨ template<class T> class allocator; template<class T, class U> bool operator==(const allocator<T>&, const allocator<U>&) noexcept; template<class T, class U> bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;  // ç¹åçç®æ³ // ç¹æ®å åæ¦å¿µ template<class I> concept __NoThrowInputIterator = /* è§å®ä¹ */; // ä» ç¨äºéé template<class I> concept __NoThrowForwardIterator = /* è§å®ä¹ */; // ä» ç¨äºéé template<class S, class I> concept __NoThrowSentinel = /* è§å®ä¹ */; // ä» ç¨äºéé template<class R> concept __NoThrowInputRange = /* è§å®ä¹ */; // ä» ç¨äºéé template<class R> concept __NoThrowForwardRange = /* è§å®ä¹ */; // ä» ç¨äºéé  template<class T> constexpr T* addressof(T& r) noexcept; template<class T> const T* addressof(const T&&) = delete; template<class ForwardIt> void uninitialized_default_construct(ForwardIt first, ForwardIt last); template<class ExecutionPolicy, class ForwardIt> void uninitialized_default_construct(ExecutionPolicy&& exec, ForwardIt first, ForwardIt last); template<class ForwardIt, class Size> ForwardIt uninitialized_default_construct_n(ForwardIt first, Size n); template<class ExecutionPolicy, class ForwardIt, class Size> ForwardIt uninitialized_default_construct_n(ExecutionPolicy&& exec, ForwardIt first, Size n);  namespace ranges { template<__NoThrowForwardIterator I, __NoThrowSentinel<I> S> requires DefaultConstructible<iter_value_t<I>> I uninitialized_default_construct(I first, S last); template<__NoThrowForwardRange R> requires DefaultConstructible<iter_value_t<iterator_t<R>>> safe_iterator_t<R> uninitialized_default_construct(R&& r);  template<__NoThrowForwardIterator I> requires DefaultConstructible<iter_value_t<I>> I uninitialized_default_construct_n(I first, iter_difference_t<I> n); }  template<class ForwardIt> void uninitialized_value_construct(ForwardIt first, ForwardIt last); template<class ExecutionPolicy, class ForwardIt> void uninitialized_value_construct(ExecutionPolicy&& exec, ForwardIt first, ForwardIt last); template<class ForwardIt, class Size> ForwardIt uninitialized_value_construct_n(ForwardIt first, Size n); template<class ExecutionPolicy, class ForwardIt, class Size> ForwardIt uninitialized_value_construct_n(ExecutionPolicy&& exec, ForwardIt first, Size n);  namespace ranges { template<__NoThrowForwardIterator I, __NoThrowSentinel<I> S> requires DefaultConstructible<iter_value_t<I>> I uninitialized_value_construct(I first, S last); template<__NoThrowForwardRange R> requires DefaultConstructible<iter_value_t<iterator_t<R>>> safe_iterator_t<R> uninitialized_value_construct(R&& r);  template<__NoThrowForwardIterator I> requires DefaultConstructible<iter_value_t<I>> I uninitialized_value_construct_n(I first, iter_difference_t<I> n); }  template<class InputIt, class ForwardIt> ForwardIt uninitialized_copy(InputIt first, InputIt last, ForwardIt result); template<class ExecutionPolicy, class InputIt, class ForwardIt> ForwardIt uninitialized_copy(ExecutionPolicy&& exec, InputIt first, InputIt last, ForwardIt result); template<class InputIt, class Size, class ForwardIt> ForwardIt uninitialized_copy_n(InputIt first, Size n, ForwardIt result); template<class ExecutionPolicy, class InputIt, class Size, class ForwardIt> ForwardIt uninitialized_copy_n(ExecutionPolicy&& exec, InputIt first, Size n, ForwardIt result);  namespace ranges { template<class I, class O> using uninitialized_copy_result = copy_result<I, O>; template<InputIterator I, Sentinel<I> S1, __NoThrowForwardIterator O, __NoThrowSentinel<O> S2> requires Constructible<iter_value_t<O>, iter_reference_t<I>> uninitialized_copy_result<I, O> uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); template<InputRange IR, __NoThrowForwardRange OR> requires Constructible<iter_value_t<iterator_t<OR>>, iter_reference_t<iterator_t<IR>>> uninitialized_copy_result<safe_iterator_t<IR>, safe_iterator_t<OR>> uninitialized_copy(IR&& input_range, OR&& output_range);  template<class I, class O> using uninitialized_copy_n_result = uninitialized_copy_result<I, O>; template<InputIterator I, __NoThrowForwardIterator O, __NoThrowSentinel<O> S> requires Constructible<iter_value_t<O>, iter_reference_t<I>> uninitialized_copy_n_result<I, O> uninitialized_copy_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast); }  template<class InputIt, class ForwardIt> ForwardIt uninitialized_move(InputIt first, InputIt last, ForwardIt result); template<class ExecutionPolicy, class InputIt, class ForwardIt> ForwardIt uninitialized_move(ExecutionPolicy&& exec, InputIt first, InputIt last, ForwardIt result); template<class InputIt, class Size, class ForwardIt> pair<InputIt, ForwardIt> uninitialized_move_n(InputIt first, Size n, ForwardIt result); template<class ExecutionPolicy, class InputIt, class Size, class ForwardIt> pair<InputIt, ForwardIt> uninitialized_move_n(ExecutionPolicy&& exec, InputIt first, Size n, ForwardIt result);  namespace ranges { template<class I, class O> using uninitialized_move_result = uninitialized_copy_result<I, O>; template<InputIterator I, Sentinel<I> S1, __NoThrowForwardIterator O, __NoThrowSentinel<O> S2> requires Constructible<iter_value_t<O>, iter_rvalue_reference_t<I>> uninitialized_move_result<I, O> uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); template<InputRange IR, __NoThrowForwardRange OR> requires Constructible<iter_value_t<iterator_t<OR>>, iter_rvalue_reference_t<iterator_t<IR>>> uninitialized_move_result<safe_iterator_t<IR>, safe_iterator_t<OR>> uninitialized_move(IR&& input_range, OR&& output_range);  template<class I, class O> using uninitialized_move_n_result = uninitialized_copy_result<I, O>; template<InputIterator I, __NoThrowForwardIterator O, __NoThrowSentinel<O> S> requires Constructible<iter_value_t<O>, iter_rvalue_reference_t<I>> uninitialized_move_n_result<I, O> uninitialized_move_n(I ifirst, iter_difference_t<I> n, O ofirst, S olast); }  template<class ForwardIt, class T> void uninitialized_fill(ForwardIt first, ForwardIt last, const T& x); template<class ExecutionPolicy, class ForwardIt, class T> void uninitialized_fill(ExecutionPolicy&& exec, ForwardIt first, ForwardIt last, const T& x); template<class ForwardIt, class Size, class T> ForwardIt uninitialized_fill_n(ForwardIt first, Size n, const T& x); template<class ExecutionPolicy, class ForwardIt, class Size, class T> ForwardIt uninitialized_fill_n(ExecutionPolicy&& exec, ForwardIt first, Size n, const T& x);  namespace ranges { template<__NoThrowForwardIterator I, __NoThrowSentinel<I> S, class T> requires Constructible<iter_value_t<I>, const T&> I uninitialized_fill(I first, S last, const T& x); template<__NoThrowForwardRange R, class T> requires Constructible<iter_value_t<iterator_t<R>>, const T&> safe_iterator_t<R> uninitialized_fill(R&& r, const T& x);  template<__NoThrowForwardIterator I, class T> requires Constructible<iter_value_t<I>, const T&> I uninitialized_fill_n(I first, iter_difference_t<I> n, const T& x); }  template<class T> void destroy_at(T* location); template<class ForwardIt> void destroy(ForwardIt first, ForwardIt last); template<class ExecutionPolicy, class ForwardIt> void destroy(ExecutionPolicy&& exec, ForwardIt first, ForwardIt last); template<class ForwardIt, class Size> ForwardIt destroy_n(ForwardIt first, Size n); template<class ExecutionPolicy, class ForwardIt, class Size> ForwardIt destroy_n(ExecutionPolicy&& exec, ForwardIt first, Size n);  namespace ranges { template<Destructible T> void destroy_at(T* location) noexcept;  template<__NoThrowInputIterator I, __NoThrowSentinel<I> S> requires Destructible<iter_value_t<I>> I destroy(I first, S last) noexcept; template<__NoThrowInputRange R> requires Destructible<iter_value_t<iterator_t<R>> safe_iterator_t<R> destroy(R&& r) noexcept;  template<__NoThrowInputIterator I> requires Destructible<iter_value_t<I>> I destroy_n(I first, iter_difference_t<I> n) noexcept; }  // ç±»æ¨¡æ¿ unique_ptr template<class T> struct default_delete; template<class T> struct default_delete<T[]>; template<class T, class D = default_delete<T>> class unique_ptr; template<class T, class D> class unique_ptr<T[], D>;  template<class T, class... Args> unique_ptr<T> make_unique(Args&&... args); // T éæ°ç» template<class T> unique_ptr<T> make_unique(size_t n); // T 为 U[] template<class T, class... Args> /* æªææ */ make_unique(Args&&...) = delete; // T 为 U[N]  template<class T> unique_ptr<T> make_unique_default_init(); // T éæ°ç» template<class T> unique_ptr<T> make_unique_default_init(size_t n); // T 为 U[] template<class T, class... Args> /* æªææ */ make_unique_default_init(Args&&...) = delete; // T 为 U[N]  template<class T, class D> void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;  template<class T1, class D1, class T2, class D2> bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2> bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2> bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2> bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2> bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y); template<class T1, class D1, class T2, class D2> bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);  template<class T, class D> bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept; template<class T, class D> bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept; template<class T, class D> bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept; template<class T, class D> bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept; template<class T, class D> bool operator<(const unique_ptr<T, D>& x, nullptr_t); template<class T, class D> bool operator<(nullptr_t, const unique_ptr<T, D>& y); template<class T, class D> bool operator>(const unique_ptr<T, D>& x, nullptr_t); template<class T, class D> bool operator>(nullptr_t, const unique_ptr<T, D>& y); template<class T, class D> bool operator<=(const unique_ptr<T, D>& x, nullptr_t); template<class T, class D> bool operator<=(nullptr_t, const unique_ptr<T, D>& y); template<class T, class D> bool operator>=(const unique_ptr<T, D>& x, nullptr_t); template<class T, class D> bool operator>=(nullptr_t, const unique_ptr<T, D>& y);  template<class E, class T, class Y, class D> basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);  // ç±» bad_weak_ptr class bad_weak_ptr;  // ç±»æ¨¡æ¿ shared_ptr template<class T> class shared_ptr;  // shared_ptr å建 template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args); // T éæ°ç» template<class T, class A, class... Args> shared_ptr<T> allocate_shared(const A& a, Args&&... args); // T éæ°ç» Â template<class T> shared_ptr<T> make_shared(size_t N); // T 为 U[] template<class T, class A> shared_ptr<T> allocate_shared(const A& a, size_t N); // T 为 U[]  template<class T> shared_ptr<T> make_shared(); // T 为 U[N] template<class T, class A> shared_ptr<T> allocate_shared(const A& a); // T 为 U[N]  template<class T> shared_ptr<T> make_shared(size_t N, const remove_extent_t<T>& u); // T 为 U[] template<class T, class A> shared_ptr<T> allocate_shared(const A& a, size_t N, const remove_extent_t<T>& u); // T 为 U[]  template<class T> shared_ptr<T> make_shared(const remove_extent_t<T>& u); // T 为 U[N] template<class T, class A> shared_ptr<T> allocate_shared(const A& a, const remove_extent_t<T>& u); // T 为 U[N]  template<class T> shared_ptr<T> make_shared_default_init(); // T é U[] template<class T, class A> shared_ptr<T> allocate_shared_default_init(const A& a); // T é U[]  template<class T> shared_ptr<T> make_shared_default_init(size_t N); // T 为 U[] template<class T, class A> shared_ptr<T> allocate_shared_default_init(const A& a, size_t N); // T 为 U[]  // shared_ptr æ¯è¾ template<class T, class U> bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept; template<class T, class U> bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept; template<class T, class U> bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept; template<class T, class U> bool operator>(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept; template<class T, class U> bool operator<=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept; template<class T, class U> bool operator>=(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;  template<class T> bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept; template<class T> bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept; template<class T> bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept; template<class T> bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept; template<class T> bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept; template<class T> bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept; template<class T> bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept; template<class T> bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept; template<class T> bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept; template<class T> bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept; template<class T> bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept; template<class T> bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept;  // shared_ptr ç¹åç®æ³ template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;  // shared_ptr 转å template<class T, class U> shared_ptr<T> static_pointer_cast(const shared_ptr<U>& r) noexcept; template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U>&& r) noexcept; template<class T, class U> shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& r) noexcept; template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U>&& r) noexcept; template<class T, class U> shared_ptr<T> const_pointer_cast(const shared_ptr<U>& r) noexcept; template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U>&& r) noexcept; template<class T, class U> shared_ptr<T> reinterpret_pointer_cast(const shared_ptr<U>& r) noexcept; template<class T, class U> shared_ptr<T> reinterpret_pointer_cast(shared_ptr<U>&& r) noexcept;  // shared_ptr get_deleter template<class D, class T> D* get_deleter(const shared_ptr<T>& p) noexcept;  // shared_ptr I/O template<class E, class T, class Y> basic_ostream<E, T>& operator<<(basic_ostream<E, T>& os, const shared_ptr<Y>& p);  // ç±»æ¨¡æ¿ weak_ptr template<class T> class weak_ptr;  // weak_ptr ç¹åç®æ³ template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;  // ç±»æ¨¡æ¿ owner_less template<class T = void> struct owner_less;  // ç±»æ¨¡æ¿ enable_shared_from_this template<class T> class enable_shared_from_this;  // æ£åæ¯æ template<class T> struct hash; template<class T, class D> struct hash<unique_ptr<T, D>>; template<class T> struct hash<shared_ptr<T>>;  // ååæºè½æé template<class T> struct atomic; template<class T> struct atomic<shared_ptr<T>>; template<class T> struct atomic<weak_ptr<T>>;  // shared_ptr ååè®¿é® template<class T> bool atomic_is_lock_free(const shared_ptr<T>* p); template<class T> shared_ptr<T> atomic_load(const shared_ptr<T>* p); template<class T> shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo); template<class T> void atomic_store(shared_ptr<T>* p, shared_ptr<T> r); template<class T> void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo); template<class T> shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r); template<class T> shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo); template<class T> bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w); template<class T> bool atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w); template<class T> bool atomic_compare_exchange_weak_explicit(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure); template<class T> bool atomic_compare_exchange_strong_explicit(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure); }
è¾ å©æ¦å¿µ
template<class I> concept __NoThrowInputIterator = // ä» ç¨äºéé InputIterator<I> && is_lvalue_reference_v<iter_reference_t<I>> && Same<remove_cvref_t<iter_reference_t<I>>, iter_value_t<I>>;  template<class S, class I> concept __NoThrowSentinel = Sentinel<S, I>; // ä» ç¨äºéé  template<class R> concept __NoThrowInputRange = // ä» ç¨äºéé Range<R> && __NoThrowInputIterator<iterator_t<R>> && __NoThrowSentinel<sentinel_t<R>, iterator_t<R>>;  template<class I> concept __NoThrowForwardIterator = // ä» ç¨äºéé __NoThrowInputIterator<I> && ForwardIterator<I> && __NoThrowSentinel<I, I>;  template<class R> concept __NoThrowForwardRange = // ä» ç¨äºéé __NoThrowInputRange<R> && __NoThrowForwardIterator<iterator_t<R>>;
注æï¼è¿äºåç§°ä» ç¨äºééç®çï¼å®ä»¬å¹¶ä¸æ¯æ¥å£çä¸é¨åã
ç±»æ¨¡æ¿ std::pointer_traits
namespace std { template <class Ptr> struct pointer_traits { using pointer = Ptr; using element_type = /* è§å®ä¹ */; using difference_type = /* è§å®ä¹ */; template <class U> using rebind = /* è§å®ä¹ */; static pointer pointer_to(/* è§å®ä¹ */ r); };  template <class T> struct pointer_traits<T*> { using pointer = T*; using element_type = T; using difference_type = ptrdiff_t; template <class U> using rebind = U*; static constexpr pointer pointer_to(/* è§å®ä¹ */ r) noexcept; }; }
ç±» std::allocator_arg_t
namespace std { struct allocator_arg_t { explicit allocator_arg_t() = default; }; inline constexpr allocator_arg_t allocator_arg{}; }
ç±»æ¨¡æ¿ std::allocator_traits
namespace std { template<class Alloc> struct allocator_traits { using allocator_type = Alloc;  using value_type = typename Alloc::value_type;  using pointer = /* è§å®ä¹ */; using const_pointer = /* è§å®ä¹ */; using void_pointer = /* è§å®ä¹ */; using const_void_pointer = /* è§å®ä¹ */;  using difference_type = /* è§å®ä¹ */; using size_type = /* è§å®ä¹ */;  using propagate_on_container_copy_assignment = /* è§å®ä¹ */; using propagate_on_container_move_assignment = /* è§å®ä¹ */; using propagate_on_container_swap = /* è§å®ä¹ */; using is_always_equal = /* è§å®ä¹ */;  template<class T> using rebind_alloc = /* è§å®ä¹ */; template<class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;  [[nodiscard]] static pointer allocate(Alloc& a, size_type n); [[nodiscard]] static pointer allocate(Alloc& a, size_type n, const_void_pointer hint);  static void deallocate(Alloc& a, pointer p, size_type n);  template<class T, class... Args> static void construct(Alloc& a, T* p, Args&&... args);  template<class T> static void destroy(Alloc& a, T* p);  static size_type max_size(const Alloc& a) noexcept;  static Alloc select_on_container_copy_construction(const Alloc& rhs); }; }
ç±»æ¨¡æ¿ std::allocator
namespace std { template<class T> class allocator { public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; using propagate_on_container_move_assignment = true_type; using is_always_equal = true_type; Â constexpr allocator() noexcept; constexpr allocator(const allocator&) noexcept; template<class U> constexpr allocator(const allocator<U>&) noexcept; ~allocator(); allocator& operator=(const allocator&) = default; Â [[nodiscard]] T* allocate(size_t n); void deallocate(T* p, size_t n); }; }
ç±»æ¨¡æ¿ std::default_delete
namespace std { template<class T> struct default_delete { constexpr default_delete() noexcept = default; template<class U> default_delete(const default_delete<U>&) noexcept; void operator()(T*) const; }; Â template<class T> struct default_delete<T[]> { constexpr default_delete() noexcept = default; template<class U> default_delete(const default_delete<U[]>&) noexcept; template<class U> void operator()(U* ptr) const; }; }
ç±»æ¨¡æ¿ std::unique_ptr
namespace std { template<class T, class D = default_delete<T>> class unique_ptr { public: using pointer = /* è§å®ä¹ */; using element_type = T; using deleter_type = D;  // æé 彿° constexpr unique_ptr() noexcept; explicit unique_ptr(pointer p) noexcept; unique_ptr(pointer p, /* è§å®ä¹ */ d1) noexcept; unique_ptr(pointer p, /* è§å®ä¹ */ d2) noexcept; unique_ptr(unique_ptr&& u) noexcept; constexpr unique_ptr(nullptr_t) noexcept; template<class U, class E> unique_ptr(unique_ptr<U, E>&& u) noexcept;  // ææå½æ° ~unique_ptr();  // èµå¼ unique_ptr& operator=(unique_ptr&& u) noexcept; template<class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept; unique_ptr& operator=(nullptr_t) noexcept;  // æ¢æ¥å½æ° add_lvalue_reference_t<T> operator*() const; pointer operator->() const noexcept; pointer get() const noexcept; deleter_type& get_deleter() noexcept; const deleter_type& get_deleter() const noexcept; explicit operator bool() const noexcept;  // ä¿®æ¹å½æ° pointer release() noexcept; void reset(pointer p = pointer()) noexcept; void swap(unique_ptr& u) noexcept;  // ç¦ç¨ä»å·¦å¼å¤å¶ unique_ptr(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete; };  template<class T, class D> class unique_ptr<T[], D> { public: using pointer = /* è§å®ä¹ */; using element_type = T; using deleter_type = D;  // æé 彿° constexpr unique_ptr() noexcept; template<class U> explicit unique_ptr(U p) noexcept; template<class U> unique_ptr(U p, /* è§å®ä¹ */ d) noexcept; template<class U> unique_ptr(U p, /* è§å®ä¹ */ d) noexcept; unique_ptr(unique_ptr&& u) noexcept; template<class U, class E> unique_ptr(unique_ptr<U, E>&& u) noexcept; constexpr unique_ptr(nullptr_t) noexcept;  // ææå½æ° ~unique_ptr();  // èµå¼ unique_ptr& operator=(unique_ptr&& u) noexcept; template<class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept; unique_ptr& operator=(nullptr_t) noexcept;  // æ¢å¯å½æ° T& operator[](size_t i) const; pointer get() const noexcept; deleter_type& get_deleter() noexcept; const deleter_type& get_deleter() const noexcept; explicit operator bool() const noexcept;  // ä¿®æ¹å½æ° pointer release() noexcept; template<class U> void reset(U p) noexcept; void reset(nullptr_t = nullptr) noexcept; void swap(unique_ptr& u) noexcept;  // ç¦ç¨ä»å·¦å¼å¤å¶ unique_ptr(const unique_ptr&) = delete; unique_ptr& operator=(const unique_ptr&) = delete; }; }
ç±» std::bad_weak_ptr
namespace std { class bad_weak_ptr : public exception { public: bad_weak_ptr() noexcept; }; }
namespace std { template<class T> class shared_ptr { public: using element_type = remove_extent_t<T>; using weak_type = weak_ptr<T>;  // æé 彿° constexpr shared_ptr() noexcept; constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { } template<class Y> explicit shared_ptr(Y* p); template<class Y, class D> shared_ptr(Y* p, D d); template<class Y, class D, class A> shared_ptr(Y* p, D d, A a); template<class D> shared_ptr(nullptr_t p, D d); template<class D, class A> shared_ptr(nullptr_t p, D d, A a); template<class Y> shared_ptr(const shared_ptr<Y>& r, element_type* p) noexcept; template<class Y> shared_ptr(shared_ptr<Y>&& r, element_type* p) noexcept; shared_ptr(const shared_ptr& r) noexcept; template<class Y> shared_ptr(const shared_ptr<Y>& r) noexcept; shared_ptr(shared_ptr&& r) noexcept; template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept; template<class Y> explicit shared_ptr(const weak_ptr<Y>& r); template<class Y, class D> shared_ptr(unique_ptr<Y, D>&& r);  // ææå½æ° ~shared_ptr();  // èµå¼ shared_ptr& operator=(const shared_ptr& r) noexcept; template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r) noexcept; shared_ptr& operator=(shared_ptr&& r) noexcept; template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r) noexcept; template<class Y, class D> shared_ptr& operator=(unique_ptr<Y, D>&& r);  // ä¿®æ¹å½æ° void swap(shared_ptr& r) noexcept; void reset() noexcept; template<class Y> void reset(Y* p); template<class Y, class D> void reset(Y* p, D d); template<class Y, class D, class A> void reset(Y* p, D d, A a);  // æ¢å¯å½æ° element_type* get() const noexcept; T& operator*() const noexcept; T* operator->() const noexcept; element_type& operator[](ptrdiff_t i) const; long use_count() const noexcept; explicit operator bool() const noexcept; template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept; template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept; };  template<class T> shared_ptr(weak_ptr<T>) -> shared_ptr<T>; template<class T, class D> shared_ptr(unique_ptr<T, D>) -> shared_ptr<T>; }
ç±»æ¨¡æ¿ std::weak_ptr
namespace std { template<class T> class weak_ptr { public: using element_type = remove_extent_t<T>;  // æé 彿° constexpr weak_ptr() noexcept; template<class Y> weak_ptr(const shared_ptr<Y>& r) noexcept; weak_ptr(const weak_ptr& r) noexcept; template<class Y> weak_ptr(const weak_ptr<Y>& r) noexcept; weak_ptr(weak_ptr&& r) noexcept; template<class Y> weak_ptr(weak_ptr<Y>&& r) noexcept;  // ææå½æ° ~weak_ptr();  // èµå¼ weak_ptr& operator=(const weak_ptr& r) noexcept; template<class Y> weak_ptr& operator=(const weak_ptr<Y>& r) noexcept; template<class Y> weak_ptr& operator=(const shared_ptr<Y>& r) noexcept; weak_ptr& operator=(weak_ptr&& r) noexcept; template<class Y> weak_ptr& operator=(weak_ptr<Y>&& r) noexcept;  // ä¿®æ¹å½æ° void swap(weak_ptr& r) noexcept; void reset() noexcept;  // æ¢å¯å½æ° long use_count() const noexcept; bool expired() const noexcept; shared_ptr<T> lock() const noexcept; template<class U> bool owner_before(const shared_ptr<U>& b) const noexcept; template<class U> bool owner_before(const weak_ptr<U>& b) const noexcept; };  template<class T> weak_ptr(shared_ptr<T>) -> weak_ptr<T>; }
ç±»æ¨¡æ¿ std::owner_less
namespace std { template<class T = void> struct owner_less;  template<class T> struct owner_less<shared_ptr<T>> { bool operator()(const shared_ptr<T>&, const shared_ptr<T>&) const noexcept; bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept; bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept; };  template<class T> struct owner_less<weak_ptr<T>> { bool operator()(const weak_ptr<T>&, const weak_ptr<T>&) const noexcept; bool operator()(const shared_ptr<T>&, const weak_ptr<T>&) const noexcept; bool operator()(const weak_ptr<T>&, const shared_ptr<T>&) const noexcept; };  template<> struct owner_less<void> { template<class T, class U> bool operator()(const shared_ptr<T>&, const shared_ptr<U>&) const noexcept; template<class T, class U> bool operator()(const shared_ptr<T>&, const weak_ptr<U>&) const noexcept; template<class T, class U> bool operator()(const weak_ptr<T>&, const shared_ptr<U>&) const noexcept; template<class T, class U> bool operator()(const weak_ptr<T>&, const weak_ptr<U>&) const noexcept;  using is_transparent = /* æªææ */; }; }
namespace std { template<class T> class enable_shared_from_this { protected: constexpr enable_shared_from_this() noexcept; enable_shared_from_this(const enable_shared_from_this&) noexcept; enable_shared_from_this& operator=(const enable_shared_from_this&) noexcept; ~enable_shared_from_this();  public: shared_ptr<T> shared_from_this(); shared_ptr<T const> shared_from_this() const; weak_ptr<T> weak_from_this() noexcept; weak_ptr<T const> weak_from_this() const noexcept;  private: mutable weak_ptr<T> weak_this; // ä» ç¨äºéé }; }
namespace std { template<class T> struct atomic<shared_ptr<T>> { using value_type = shared_ptr<T>; static constexpr bool is_always_lock_free = /* ç±å®ç°å®ä¹ */;  bool is_lock_free() const noexcept; void store(shared_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept; shared_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept; operator shared_ptr<T>() const noexcept;  shared_ptr<T> exchange(shared_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;  bool compare_exchange_weak(shared_ptr<T>& expected, shared_ptr<T> desired, memory_order success, memory_order failure) noexcept; bool compare_exchange_strong(shared_ptr<T>& expected, shared_ptr<T> desired, memory_order success, memory_order failure) noexcept;  bool compare_exchange_weak(shared_ptr<T>& expected, shared_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept; bool compare_exchange_strong(shared_ptr<T>& expected, shared_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;  constexpr atomic() noexcept = default; atomic(shared_ptr<T> desired) noexcept; atomic(const atomic&) = delete; void operator=(const atomic&) = delete; void operator=(shared_ptr<T> desired) noexcept;  private: shared_ptr<T> p; // ä» ç¨äºéé }; }
ç±»æ¨¡æ¿ std::atomic é对 std::weak_ptr çç¹å
namespace std { template<class T> struct atomic<weak_ptr<T>> { using value_type = weak_ptr<T>; static constexpr bool is_always_lock_free = /* ç±å®ç°å®ä¹ */;  bool is_lock_free() const noexcept; void store(weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept; weak_ptr<T> load(memory_order order = memory_order::seq_cst) const noexcept; operator weak_ptr<T>() const noexcept;  weak_ptr<T> exchange(weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;  bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired, memory_order success, memory_order failure) noexcept; bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired, memory_order success, memory_order failure) noexcept;  bool compare_exchange_weak(weak_ptr<T>& expected, weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept; bool compare_exchange_strong(weak_ptr<T>& expected, weak_ptr<T> desired, memory_order order = memory_order::seq_cst) noexcept;  constexpr atomic() noexcept = default; atomic(weak_ptr<T> desired) noexcept; atomic(const atomic&) = delete; void operator=(const atomic&) = delete; void operator=(weak_ptr<T> desired) noexcept;  private: weak_ptr<T> p; // ä» ç¨äºéé }; }