Template Struct enable_self
Defined in File enable_self.hpp
Inheritance Relationships
Derived Type
public beluga::BaseRegularGrid< SparseValueGrid< MapType, NDim >, NDim >(Template Class BaseRegularGrid)
Struct Documentation
-
template<typename MostDerived>
struct enable_self An implementation of a mixin that provides downcasting methods.
This class is a mixin that can be used in CRTP base classes to provide convenience downcasting methods to access the most derived class.
Typical CRTP example:
template <typename Derived> struct Base { void call() { static_cast<T*>(this)->implementation(); } }; struct Derived : public Base<Derived> { void implementation() {} };
With the
enable_selfmixin:template <typename Derived> struct Base : enable_self<Derived> { using enable_self<Derived>::self; void call() { self()->implementation(); } }; struct Derived : public Base<Derived> { void implementation() {} };
Subclassed by beluga::BaseRegularGrid< SparseValueGrid< MapType, NDim >, NDim >
Public Types
-
using self_type = MostDerived
The type of the most derived class.
Public Functions
-
inline decltype(auto) self() &
Downcast this to a mutable lvalue reference.
-
inline decltype(auto) self() &&
Downcast this to a mutable rvalue reference.
-
inline decltype(auto) self() const &
Downcast this to a const lvalue reference.
-
inline decltype(auto) self() const &&
Downcast this to a const rvalue reference.
-
using self_type = MostDerived