MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / WrapShared

Function WrapShared

common/memory.h:1019–1032  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1017
1018template <typename T>
1019Owned<T> WrapShared(T* object, Allocator<> allocator) {
1020 Owner owner;
1021 if (object == nullptr) {
1022 } else if (allocator.arena() != nullptr) {
1023 owner.ptr_ = reinterpret_cast<uintptr_t>(
1024 static_cast<google::protobuf::Arena*>(allocator.arena())) |
1025 common_internal::kMetadataOwnerArenaBit;
1026 } else {
1027 owner.ptr_ = reinterpret_cast<uintptr_t>(
1028 common_internal::MakeDeletingReferenceCount(object)) |
1029 common_internal::kMetadataOwnerReferenceCountBit;
1030 }
1031 return Owned<T>(object, std::move(owner));
1032}
1033
1034template <typename T>
1035std::enable_if_t<!std::is_const_v<T>, Owned<T>> WrapShared(T* object) {

Callers 2

TEST_PFunction · 0.85

Calls 2

arenaMethod · 0.45
GetArenaMethod · 0.45

Tested by 2

TEST_PFunction · 0.68