Ginkgo: gko::ptr_param< T > Class Template Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
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_param & | operator= (const ptr_param &)=delete
ptr_param & | operator= (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

  T | the pointed-to type

## Member Function Documentation

## ◆ get()

template<typename T>

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

Returns
  the underlying pointer.

Referenced by gko::LinOp::apply(), gko::LinOp::apply(), gko::LinOp::apply(), gko::LinOp::apply(), gko::as(), gko::as(), gko::convert_to(), gko::Executor::copy_from(), gko::matrix::Diagonal< ValueType >::inverse_apply(), gko::PolymorphicObject::move_from(), gko::move_to(), ptr_param(), ptr_param(), ptr_param(), gko::matrix::Diagonal< ValueType >::rapply(), and gko::log::Loggable::remove_logger().

## ◆ 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:

- ginkgo/core/base/utils_helper.hpp