Namespaces
Variants

std:: owner_hash

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
헤더 파일에 정의됨 <memory>
struct owner_hash ;
(C++26부터)

이 함수 객체는 std::weak_ptr std::shared_ptr 모두에 대해 값 기반(value-based)이 아닌 소유자 기반(owner-based) 해싱을 제공합니다.

목차

중첩 타입

중첩 타입 정의
is_transparent unspecified

멤버 함수

operator()
공유 소유권 포인터의 해시를 계산합니다
(함수)

std::owner_hash:: operator()

template < class T >
std:: size_t operator ( ) ( const std:: shared_ptr < T > & key ) const noexcept ;
(1) (C++26부터)
template < class T >
std:: size_t operator ( ) ( const std:: weak_ptr < T > & key ) const noexcept ;
(2) (C++26부터)

return key. owner_hash ( ) ; 와 동등합니다.

매개변수

key - 해시할 공유 소유권 포인터

반환 값

동일한 소유권을 공유하는 모든 std::shared_ptr 또는 std::weak_ptr 객체에 대해 동일한 해시 값

참고 사항

기능 테스트 매크로 표준 기능
__cpp_lib_smart_ptr_owner_equality 202306L (C++26) 비정렬 연관 컨테이너 에서 std::shared_ptr std::weak_ptr 를 키로 사용할 수 있도록 설정

참고 항목

(C++26)
shared pointer의 소유자 기반 해싱을 제공함
( std::shared_ptr<T> 의 public member function)
(C++26)
weak pointer의 소유자 기반 해싱을 제공함
( std::weak_ptr<T> 의 public member function)