guanaqo 1.0.0-alpha.25
Utilities for scientific software
Loading...
Searching...
No Matches
guanaqo::any_ptr Class Reference

#include <guanaqo/any-ptr.hpp>

Detailed Description

Like std::any, but storing just the pointer, without any dynamic allocation.

Definition at line 16 of file any-ptr.hpp.

Collaboration diagram for guanaqo::any_ptr:

Public Member Functions

 any_ptr ()=default
template<class T>
 any_ptr (T *ptr) noexcept
template<class T>
T * cast () const
bool has_value () const noexcept
bool is_immutable () const noexcept
const std::type_info & type () const noexcept

Private Attributes

void * ptr = nullptr
const std::type_info * ptr_type = &typeid(void)
bool is_const = true

Constructor & Destructor Documentation

◆ any_ptr() [1/2]

guanaqo::any_ptr::any_ptr ( )
default

◆ any_ptr() [2/2]

template<class T>
guanaqo::any_ptr::any_ptr ( T * ptr)
inlinenoexcept

Definition at line 20 of file any-ptr.hpp.

Member Function Documentation

◆ cast()

template<class T>
T * guanaqo::any_ptr::cast ( ) const
inline

Definition at line 25 of file any-ptr.hpp.

Here is the call graph for this function:

◆ has_value()

bool guanaqo::any_ptr::has_value ( ) const
inlinenodiscardnoexcept

Definition at line 35 of file any-ptr.hpp.

◆ is_immutable()

bool guanaqo::any_ptr::is_immutable ( ) const
inlinenodiscardnoexcept

Definition at line 36 of file any-ptr.hpp.

◆ type()

const std::type_info & guanaqo::any_ptr::type ( ) const
inlinenodiscardnoexcept

Definition at line 37 of file any-ptr.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ ptr

void* guanaqo::any_ptr::ptr = nullptr
private

Definition at line 42 of file any-ptr.hpp.

◆ ptr_type

const std::type_info* guanaqo::any_ptr::ptr_type = &typeid(void)
private

Definition at line 43 of file any-ptr.hpp.

◆ is_const

bool guanaqo::any_ptr::is_const = true
private

Definition at line 44 of file any-ptr.hpp.


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