absl::RawPtr

Extract the raw pointer from a pointer-like value.

Synopsis

Declared in <absl/memory/memory.h>

template<typename T>
decltype(std::addressof(*ptr))
RawPtr(T&& ptr);

Description

Extracts the raw pointer from a pointer-like value ptr. absl::RawPtr is useful within templates that need to handle a complement of raw pointers, std::nullptr_t, and smart pointers.

Return Value

The underlying raw pointer, or nullptr if ptr is null.

Parameters

NameDescription
ptrThe pointer-like value to extract from.