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

This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that have implemented conversions between them. More...

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

Inherits gko::ConvertibleTo< ResultType >.

Collaboration diagram for gko::EnablePolymorphicAssignment< ConcreteType, ResultType >:
[legend]

Public Types

using result_type = ResultType
 
- Public Types inherited from gko::ConvertibleTo< ResultType >
using result_type = ResultType
 

Public Member Functions

void convert_to (result_type *result) const override
 Converts the implementer to an object of type result_type. More...
 
void move_to (result_type *result) override
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
- Public Member Functions inherited from gko::ConvertibleTo< ResultType >
void convert_to (ptr_param< result_type > result) const
 
void move_to (ptr_param< result_type > result)
 

Detailed Description

template<typename ConcreteType, typename ResultType = ConcreteType>
class gko::EnablePolymorphicAssignment< ConcreteType, ResultType >

This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that have implemented conversions between them.

The requirement is that there is either a conversion constructor from ConcreteType in ResultType, or a conversion operator to ResultType in ConcreteType.

Template Parameters
ConcreteTypethe concrete type from which the copy_from is being enabled [CRTP parameter]
ResultTypethe type to which copy_from is being enabled

Member Function Documentation

◆ convert_to()

template<typename ConcreteType, typename ResultType = ConcreteType>
void gko::EnablePolymorphicAssignment< ConcreteType, ResultType >::convert_to ( result_type *  result) const
inlineoverridevirtual

Converts the implementer to an object of type result_type.

Parameters
resultthe object used to store the result of the conversion

Implements gko::ConvertibleTo< ResultType >.

◆ move_to()

template<typename ConcreteType, typename ResultType = ConcreteType>
void gko::EnablePolymorphicAssignment< ConcreteType, ResultType >::move_to ( result_type *  result)
inlineoverridevirtual

Converts the implementer to an object of type result_type by moving data from this object.

This method is used when the implementer is a temporary object, and move semantics can be used.

Parameters
resultthe object used to emplace the result of the conversion
Note
ConvertibleTo::move_to can be implemented by simply calling ConvertibleTo::convert_to. However, this operation can often be optimized by exploiting the fact that implementer's data can be moved to the result.

Implements gko::ConvertibleTo< ResultType >.


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