Ginkgo  Generated from pipelines/1330831941 branch based on master. Ginkgo version 1.8.0
A numerical linear algebra library targeting many-core architectures
Public Member Functions | List of all members
gko::ptr_param< T > Class Template Reference

This class is used for function parameters in the place of raw pointers. More...

#include <ginkgo/core/base/utils_helper.hpp>

Public Member Functions

 ptr_param (T *ptr)
 Initializes the ptr_param from a raw pointer.
 
template<typename U , std::enable_if_t< std::is_base_of< T, U >::value > * = nullptr>
 ptr_param (const std::shared_ptr< U > &ptr)
 Initializes the ptr_param from a shared_ptr.
 
template<typename U , typename Deleter , std::enable_if_t< std::is_base_of< T, U >::value > * = nullptr>
 ptr_param (const std::unique_ptr< U, Deleter > &ptr)
 Initializes the ptr_param from a unique_ptr.
 
template<typename U , std::enable_if_t< std::is_base_of< T, U >::value > * = nullptr>
 ptr_param (const ptr_param< U > &ptr)
 Initializes the ptr_param from a ptr_param of a derived type.
 
 ptr_param (const ptr_param &)=default
 
 ptr_param (ptr_param &&)=default
 
T & operator* () const
 
T * operator-> () const
 
T * get () const
 
 operator bool () const
 
ptr_paramoperator= (const ptr_param &)=delete
 
ptr_paramoperator= (ptr_param &&)=delete
 

Detailed Description

template<typename T>
class gko::ptr_param< T >

This class is used for function parameters in the place of raw pointers.

Pointer parameters should be used for everything that does not involve transfer of ownership. It can be converted to from raw pointers, shared pointers and unique pointers of the specified type or any derived type. This allows functions to be called without having to use gko::lend or calling .get() for every pointer argument. It probably has no use outside of function parameters, as it is immutable.

Template Parameters
Tthe pointed-to type

Member Function Documentation

◆ get()

template<typename T>
T* gko::ptr_param< T >::get ( ) const
inline

◆ operator bool()

template<typename T>
gko::ptr_param< T >::operator bool ( ) const
inlineexplicit
Returns
true iff the underlying pointer is non-null.

◆ operator*()

template<typename T>
T& gko::ptr_param< T >::operator* ( ) const
inline
Returns
a reference to the underlying pointee.

◆ operator->()

template<typename T>
T* gko::ptr_param< T >::operator-> ( ) const
inline
Returns
the underlying pointer.

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