forked from microsoft/xlang
-
Notifications
You must be signed in to change notification settings - Fork 2
TypeSig
Raymond Chen edited this page May 3, 2019
·
5 revisions
A xmr::TypeSig structure represents a type.
using value_type =
std::variant<xmr::ElementType, // index 0
xmr::coded_index<xmr::TypeDefOrRef>, // index 1
xmr::GenericTypeIndex, // index 2
xmr::GenericTypeInstSig, // index 3
xmr::GenericMethodTypeIndex>; // index 4The TypeSig::value_type represents the possible values of the Type().
-
ElementTypeis used if the type is a predefined type likeSystem.Int32orSystem.String. -
coded_index<TypeDefOrRef>is used if the type is a user-defined type. -
GenericTypeIndexis used to refer to a generic type parameter of the enclosing type. For example, theIMap<K, V>.Insertmethod would useGenericTypeIndex(0)to refer toKandGenericTypeIndex(1)to refer toV. -
GenericTypeInstSigis used if the type is an instantiation of a generic type. -
GenericMethodTypeIndexis used to refer to a generic type parameter of the enclosing method. For example, theWidget::GetValueOrDefault<T>(T defaultValue)method would useGenericMethodTypeIndex(0)to refer toT. (Not used by xlang.)
TypeSig::value_type const& Type() const noexcept;Returns information that identifies the type. See value_type above for details.
Complexity: O(1)
xmr::ElementType element_type() const noexcept;Returns the type category of the type.
Complexity: O(1)
bool is_szarray() const noexcept;Indicates whether the type is a single-dimensional zero-based array. If true, then the type reported by the TypeSig represents the underlying type of the array (in other words, the type of a single element of the array).
Complexity: O(1).