Namespaces
Variants
Views
Actions

std::is_within_lifetime

From cppreference.com
< cpp‎ | types
Revision as of 08:28, 2 August 2023 by Cooky (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
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