|
DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
|
A wrapper for pointer-like types that enforces a non-null invariant. More...
#include <not_null.h>
Public Member Functions | |
| not_null (Ptr p) | |
| Constructs from a pointer, enforcing the non-null invariant in strict mode. | |
| not_null (Ptr p, guaranteed_t) | |
Unchecked constructor for when the pointer is guaranteed to be non-null. This is an optimization to avoid redundant checks, e.g., after std::make_shared. | |
| template<typename... Args, typename = std::enable_if_t<std::is_constructible_v<Ptr, Args...> && (sizeof...(Args) > 1)>> | |
| not_null (Args &&... args) | |
| not_null (std::nullptr_t)=delete | |
| not_null & | operator= (std::nullptr_t)=delete |
| auto | get () const requires requires(const Ptr &p) |
| Returns the raw pointer. | |
| auto | get () requires requires(Ptr &p) |
| auto & | operator* () const |
| auto & | operator* () |
| auto | operator-> () const |
| auto | operator-> () |
| operator const Ptr & () const | |
A wrapper for pointer-like types that enforces a non-null invariant.
In strict mode, the constructor checks for null and throws if the invariant is violated. In relaxed mode, this wrapper is a zero-cost abstraction with no runtime checks.
| Ptr | The underlying pointer type. |
| safety_level | The safety policy to apply. |
Definition at line 40 of file not_null.h.