mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Convert FastTypeIdType from an alias to a struct.
PiperOrigin-RevId: 853275176 Change-Id: I03979c49739d1664ede2fa9be1034ddeb379447d
This commit is contained in:
committed by
Copybara-Service
parent
6d8e1a5cf0
commit
237c42c78f
@@ -135,7 +135,7 @@ inline size_t Sizeof(FlagOpFn op) {
|
||||
}
|
||||
// Returns fast type id corresponding to the value type.
|
||||
inline FlagFastTypeId FastTypeId(FlagOpFn op) {
|
||||
return reinterpret_cast<FlagFastTypeId>(
|
||||
return absl::bit_cast<FlagFastTypeId>(
|
||||
op(FlagOp::kFastTypeId, nullptr, nullptr, nullptr));
|
||||
}
|
||||
// Returns fast type id corresponding to the value type.
|
||||
@@ -168,7 +168,7 @@ inline const std::type_info* GenRuntimeTypeId() {
|
||||
// Flag help auxiliary structs.
|
||||
|
||||
// This is help argument for absl::Flag encapsulating the string literal pointer
|
||||
// or pointer to function generating it as well as enum descriminating two
|
||||
// or pointer to function generating it as well as enum discriminating two
|
||||
// cases.
|
||||
using HelpGenFunc = std::string (*)();
|
||||
|
||||
@@ -901,7 +901,7 @@ void* FlagOps(FlagOp op, const void* v1, void* v2, void* v3) {
|
||||
case FlagOp::kSizeof:
|
||||
return reinterpret_cast<void*>(static_cast<uintptr_t>(sizeof(T)));
|
||||
case FlagOp::kFastTypeId:
|
||||
return const_cast<void*>(absl::FastTypeId<T>());
|
||||
return absl::bit_cast<void*>(absl::FastTypeId<T>());
|
||||
case FlagOp::kRuntimeTypeId:
|
||||
return const_cast<std::type_info*>(GenRuntimeTypeId<T>());
|
||||
case FlagOp::kParse: {
|
||||
|
||||
Reference in New Issue
Block a user