Dune Core Modules (2.8.0)
Tag used to force late-binding lookup in Dune::Simd::Overloads. More...
Detailed Description
template<unsigned i, bool = true>
struct Dune::Simd::Overloads::ADLTag< i, bool >
Tag used to force late-binding lookup in Dune::Simd::Overloads.
This tag is used by functions in Dune::Simd
to make argument-dependent lookups (ADL) for functions in Dune::Simd::Overloads
. The property of ADL that is used here is that it binds the names of functions late, i.e. at the time of instantiation, while all other lookups bind early, i.e. at the time when the function call is parsed. Using late binding enables a function foo()
to find a functions Overloads::foo()
that has been declared only after foo()
itself has been defined:
- Note
- It is generally an error to declare a function with an ADLTag argument outside of namespace Simd::Overloads. An exception would be an abstraction implementation that declares all its implementation functions in its own implementation namespace, and then pulls them into the namespace Overloads by way of
using
.
ADLTag<i>
derives from ADLTag<i-1>
. Thus it is possible to prioritize overloads by choosing an appropriate i
. The following values for i
are predefined:
i==0,1
: these are reserved for the defaults.i==2,3
: these are reserved for the implementation for standard types.i==5,6
: these should normally be used by other implementations
The lower priority should be used by default. The higher priority can be used by an implementation to resolve ambiguities, e.g. between an overload with a by-value argument and an overload with an lvalue-reference argument.
The folloing priorities should not normally be used. However, they may sometimes be necessary:
i==4
: override standard implementation, but prefer other implementationsi==7
: try to override other implementations
i==7
is the highest supported priority.
The second (bool) template argument is to make writing abstraction implementations that use SFINAE to remove (some of) their functions from the overload set more concise. ADLTag<i,false>
is not defined, so instead of
you may write the equivalent
The documentation for this struct was generated from the following file:
- dune/common/simd/base.hh