# std::is_within_lifetime

From cppreference.com
< cpp‎ | types

Defined in header `<type_traits>` |  |
template< class T > consteval bool is_within_lifetime( const T* p ) noexcept; |  | (since C++26)

Determines whether the pointer p points to an object that is within its lifetime. During the evaluation of an expression `E` as a core constant expression, a call to `is_within_lifetime` is ill-formed unless p points to an object that is usable in constant expressions or whose complete object’s lifetime began within `E`.

### Parameters

p | - | pointer to detect

### Return value

true if pointer p points to an object that is within its lifetime; otherwise false.

### Example

| This section is incomplete Reason: example

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/types/is_within_lifetime&oldid=156448"