# std::pointer_traits<Ptr>::to_address

> C++ Atlas: `cppatlas.com/w/cpp/memory/pointer_traits/to_address` | Source: https://en.cppreference.com/w/cpp/memory/pointer_traits/to_address | Domain: Memory management | Standards: C++20

Constructs a raw pointer that references the same object as its pointer-like ("fancy pointer") argument.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <memory>
static element_type* to_address( pointer p ) noexcept; // (since C++20) (optional member of program-defined specialization)
```

Constructs a raw pointer that references the same object as its pointer-like ("fancy pointer") argument.

This function, if defined, is the inverse of `pointer_to`, and exists as the customization point to be called by `std::to_address`.

### Parameters

- `p` - fancy pointer/pointer-like object

### Return value

A raw pointer of the type `element_type*` that references the same memory location as the argument `p`.

### See also

- [`pointer_to`](https://en.cppreference.com/w/cpp/memory/pointer_traits/pointer_to) [static]: obtains a dereferenceable pointer to its argument (public static member function)
- [`to_address`](https://en.cppreference.com/w/cpp/memory/to_address) (C++20): obtains a raw pointer from a pointer-like type (function template)

---
Attribution: content from https://en.cppreference.com/w/cpp/memory/pointer_traits/to_address (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.