Ginkgo: gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase > 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::EnablePolymorphicObject< ConcreteObject, PolymorphicBase > Class Template Reference

This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a new concrete polymorphic object. More...

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

Inherits EnableAbstractPolymorphicObject< ConcreteObject, PolymorphicObject >.

Inherited by gko::experimental::distributed::Partition< LocalIndexType, GlobalIndexType >.

Collaboration diagram for gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >:
[legend]

## Detailed Description

template<typename ConcreteObject, typename PolymorphicBase = PolymorphicObject>
class gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >

This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a new concrete polymorphic object.

The mixin changes parameter and return types of appropriate public methods of PolymorphicObject in the same way EnableAbstractPolymorphicObject does. In addition, it also provides default implementations of PolymorphicObject's virtual methods by using the executor default constructor and the assignment operator of ConcreteObject. Consequently, the following is a minimal example of PolymorphicObject:

struct MyObject : EnablePolymorphicObject<MyObject> {
MyObject(std::shared_ptr<const Executor> exec)
: EnablePolymorphicObject<MyObject>(std::move(exec))
{}
};
gko::EnablePolymorphicObject
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:668
std
STL namespace.

In a way, this mixin can be viewed as an extension of default constructor/destructor/assignment operators.

Note
  This mixin does not enable copying the polymorphic object to the object of the same type (i.e. it does not implement the ConvertibleTo<ConcreteObject> interface). To enable a default implementation of this interface see the EnablePolymorphicAssignment mixin.

Template Parameters

  ConcreteObject | the concrete type which is being implemented [CRTP parameter]
  PolymorphicBase | parent of ConcreteObject in the polymorphic hierarchy, has to be a subclass of polymorphic object

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

- ginkgo/core/base/polymorphic_object.hpp