C++ Essence Library 0.1.0
A Utility Library for Modern C++ Programming
Loading...
Searching...
No Matches
essence::basic_native_handle< T, Mapped, Validator > Class Template Reference

Stores a platform-dependent handle. More...

#include <native_handle.hpp>

Public Member Functions

constexpr basic_native_handle (std::nullptr_t=nullptr) noexcept
 
template<typename U >
requires std::is_pointer_v<U>
 basic_native_handle (U value) noexcept
 Constructs the object from a pointer.
 
constexpr basic_native_handle (Mapped value) noexcept
 Constructs the object from a mapped number.
 
constexpr bool operator== (const basic_native_handle &) const noexcept=default
 
constexpr auto operator<=> (const basic_native_handle &) const noexcept=default
 
constexpr operator bool () const noexcept
 Checks whether the stored value is a valid handle.
 
template<typename U >
requires std::is_pointer_v<U>
 operator U () const noexcept
 Converts to a pointer.
 
constexpr operator Mapped () const noexcept
 Converts to a mapped number.
 

Detailed Description

template<handle_stroage_type T = std::uintptr_t, typename Mapped = T, auto Validator = &is_valid_handle_value<Mapped>>
requires handle_validator_type<Validator, Mapped>
class essence::basic_native_handle< T, Mapped, Validator >

Stores a platform-dependent handle.

Template Parameters
TThe underlying storage type.
MappedThe integral type to map the T value to (default T).
ValidatorA callable object to validate the handle.

Constructor & Destructor Documentation

◆ basic_native_handle() [1/2]

template<handle_stroage_type T = std::uintptr_t, typename Mapped = T, auto Validator = &is_valid_handle_value<Mapped>>
template<typename U >
requires std::is_pointer_v<U>
essence::basic_native_handle< T, Mapped, Validator >::basic_native_handle ( U value)
inlinenoexcept

Constructs the object from a pointer.

Template Parameters
UThe pointer type.
Parameters
valueThe pointer value.

◆ basic_native_handle() [2/2]

template<handle_stroage_type T = std::uintptr_t, typename Mapped = T, auto Validator = &is_valid_handle_value<Mapped>>
essence::basic_native_handle< T, Mapped, Validator >::basic_native_handle ( Mapped value)
inlineconstexprnoexcept

Constructs the object from a mapped number.

Parameters
valueThe mapped number.

Member Function Documentation

◆ operator bool()

template<handle_stroage_type T = std::uintptr_t, typename Mapped = T, auto Validator = &is_valid_handle_value<Mapped>>
essence::basic_native_handle< T, Mapped, Validator >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Checks whether the stored value is a valid handle.

Remarks
Assmues zero or negative one is invalid by default.

◆ operator U()

template<handle_stroage_type T = std::uintptr_t, typename Mapped = T, auto Validator = &is_valid_handle_value<Mapped>>
template<typename U >
requires std::is_pointer_v<U>
essence::basic_native_handle< T, Mapped, Validator >::operator U ( ) const
inlinenoexcept

Converts to a pointer.

Template Parameters
UThe pointer type.

The documentation for this class was generated from the following file: