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

Function MakeEmplacedReferenceCount

common/internal/reference_count.h:233–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231
232template <typename T, typename... Args>
233std::pair<T* absl_nonnull, const ReferenceCount* absl_nonnull>
234MakeEmplacedReferenceCount(Args&&... args) {
235 using U = std::remove_const_t<T>;
236 U* pointer;
237 auto* const refcount =
238 new EmplacedReferenceCount<U>(pointer, std::forward<Args>(args)...);
239 if constexpr (google::protobuf::Arena::is_arena_constructable<U>::value) {
240 ABSL_DCHECK_EQ(pointer->GetArena(), nullptr);
241 }
242 if constexpr (std::is_base_of_v<Data, T>) {
243 common_internal::SetDataReferenceCount(pointer, refcount);
244 }
245 return std::pair{static_cast<T* absl_nonnull>(pointer),
246 static_cast<const ReferenceCount* absl_nonnull>(refcount)};
247}
248
249template <typename T>
250class InlinedReferenceCount final : public ReferenceCounted {

Callers

nothing calls this directly

Calls 2

SetDataReferenceCountFunction · 0.85
GetArenaMethod · 0.45

Tested by

no test coverage detected