![]() |
Ginkgo
Generated from pipelines/3133041809 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
A temporary_conversion is a special smart pointer-like object that is designed to hold an object temporarily converted to another format. More...
#include <ginkgo/core/base/temporary_conversion.hpp>
Public Types | |
| using | value_type = T |
| using | pointer = T * |
Public Member Functions | |
| T * | get () const |
| Returns the object held by temporary_conversion. More... | |
| T * | operator-> () const |
| Calls a method on the underlying object. More... | |
Static Public Member Functions | |
| template<typename Other > | |
| static void | static_assert_compatibility () |
| Static assertion to check if a conversion from Other to T is possible. More... | |
| template<typename Other > | |
| static void | dynamic_assert_compatibility (Other *other) |
| Dynamic assertion to check if a conversion from Other to T is possible. More... | |
| template<typename OrigT > | |
| static temporary_conversion | create (OrigT *orig) |
| Create a temporary conversion from a bare pointer. More... | |
| template<typename OrigT > | |
| static temporary_conversion | create (std::unique_ptr< OrigT > orig) |
| Create a temporary conversion that also owns orig. More... | |
| template<typename Derived , typename = std::enable_if_t<std::is_base_of_v< std::decay_t<T>, std::decay_t<Derived>>>> | |
| static temporary_conversion | create_from_derived (temporary_conversion< Derived > &&derived) |
| Create a temporary conversion for a base type T from an object of a derived type. More... | |
| template<typename Base , typename = std::enable_if_t<std::is_base_of_v< std::decay_t<Base>, std::decay_t<T>>>> | |
| static temporary_conversion | create_from_base (temporary_conversion< Base > &&base) |
| Create a temporary conversion for a derived type T from an object of a base type. More... | |
Friends | |
| template<typename OtherT > | |
| class | temporary_conversion |
A temporary_conversion is a special smart pointer-like object that is designed to hold an object temporarily converted to another format.
After the temporary_conversion goes out of scope, the stored object will be converted back to its original format. This class is optimized to avoid copies if the object is already in the correct format, in which case it will just hold a reference to that object, without performing the conversion.
| T | the type of object held in the temporary_conversion |
|
inlinestatic |
Create a temporary conversion from a bare pointer.
| OrigT | Type of the pointer to convert from, see static_assert_compatibility for requirements. |
| orig | Object to convert from |
| NotSupported | see dynamic_assert_compatibility |
References gko::temporary_conversion< T >::dynamic_assert_compatibility().
|
inlinestatic |
Create a temporary conversion that also owns orig.
This create method takes ownership of the input pointer. It can be useful, when chaining conversion. For example if the conversion A -> C isn't implemented, but A -> B and B -> C are, then this can simplify the conversion by just chaining the two.
When the temporary conversion is deleted, orig will be deleted as well.
| OrigT | Type of the pointer to convert from, see static_assert_compatibility for requirements. |
| orig | Object to convert from and take ownership of |
| NotSupported | see dynamic_assert_compatibility |
References gko::temporary_conversion< T >::dynamic_assert_compatibility().
|
inlinestatic |
Create a temporary conversion for a derived type T from an object of a base type.
| Base | A base type of T |
| base | Object to convert from |
| NotSupported | if the dynamic type of base is not T |
Referenced by gko::as().
|
inlinestatic |
Create a temporary conversion for a base type T from an object of a derived type.
| Derived | A derived type of T |
| derived | Object to convert from |
|
inlinestatic |
Dynamic assertion to check if a conversion from Other to T is possible.
| Other | Type to convert from |
| other | the object to convert from |
| NotSupported | if:
|
Referenced by gko::temporary_conversion< T >::create().
|
inline |
Returns the object held by temporary_conversion.
|
inline |
Calls a method on the underlying object.
|
inlinestatic |
Static assertion to check if a conversion from Other to T is possible.
| Other | The type to convert from |
1.8.16