Dune Core Modules (unstable)
Dune::Hybrid::HybridFunctor< Functor > Class Template Reference
Adapter of a hybrid functor that maintains results hybrid. More...
#include <dune/common/hybridutilities.hh>
Public Member Functions | |
template<class... Args> | |
constexpr decltype(auto) | operator() (const Args &... args) const |
Adapter of a hybrid functor that keeps results hybrid. More... | |
Detailed Description
template<class Functor>
class Dune::Hybrid::HybridFunctor< Functor >
class Dune::Hybrid::HybridFunctor< Functor >
Adapter of a hybrid functor that maintains results hybrid.
This adapter will return an integral constant if all of the arguments are integral constants. That's helpful to maintain the hybrid nature of a variable after a transformation. For example, applying an operator + between two integral constants will promote the result to its underlying type (e.g. std::size_t). That's inconventient since the value of the result is not encoded in the type anymore, thus, losing its hybrid attribute (maybe still being constexpr).
using namespace Dune::Indices;
{ // non-hybrid transformation!
auto i = 1 + 2; // -> 3
// depending of the context, `k` may or may not be constexpr
}
{ // hybrid transformation!
// independent of the context, `k` encodes its value in the type system
}
Adapter of a hybrid functor that maintains results hybrid.
Definition: hybridutilities.hh:418
constexpr index_constant< 1 > _1
Compile time index with value 1.
Definition: indices.hh:55
constexpr index_constant< 2 > _2
Compile time index with value 2.
Definition: indices.hh:58
constexpr auto plus
Function object for performing addition.
Definition: hybridutilities.hh:528
Namespace with predefined compile time indices for the range [0,19].
Definition: indices.hh:50
The documentation for this class was generated from the following file:
- dune/common/hybridutilities.hh
|
Legal Statements / Impressum |
Hosted by TU Dresden |
generated with Hugo v0.111.3
(Dec 21, 23:30, 2024)