Namespaces
Variants

Standard library header <typeindex> (C++11)

From cppreference.net
Standard library headers

이 헤더는 type support 라이브러리의 일부입니다.

목차

포함 항목

(C++20)
3-way 비교 연산자 지원

클래스

(C++11)
type_info 객체를 감싸는 래퍼로, 연관 컨테이너와 비순차 연관 컨테이너에서 인덱스로 사용 가능
(클래스)
std::type_index 대한 해시 지원
(클래스 템플릿 특수화)
전방 선언
헤더 파일에 정의됨 <functional>
(C++11)
해시 함수 객체
(클래스 템플릿)

시놉시스

#include <compare>
namespace std {
  class type_index;
  template<class T> struct hash;
  template<> struct hash<type_index>;
}

클래스 std::type_index

namespace std {
  class type_index {
  public:
    type_index(const type_info& rhs) noexcept;
    bool operator==(const type_index& rhs) const noexcept;
    bool operator< (const type_index& rhs) const noexcept;
    bool operator> (const type_index& rhs) const noexcept;
    bool operator<=(const type_index& rhs) const noexcept;
    bool operator>=(const type_index& rhs) const noexcept;
    strong_ordering operator<=>(const type_index& rhs) const noexcept;
    size_t hash_code() const noexcept;
    const char* name() const noexcept;
  private:
    const type_info* target; // 설명용으로만 사용
    // 여기서 참조 대신 포인터를 사용한다는 것은
    // 기본 복사/이동 생성자와 대입 연산자가
    // 제공되고 예상대로 작동함을 의미합니다.
  };
}