Namespaces |
namespace | Impl |
Functions |
template<class T > |
constexpr auto | size (const T &t) |
| Size query.
|
template<class Container , class Index > |
constexpr | decltype (auto) elementAt(Container &&c |
| Get element at given position from container.
|
class End constexpr auto | integralRange (const Begin &begin, const End &end) |
template<class End > |
constexpr auto | integralRange (const End &end) |
| Create an integral range starting from 0.
|
template<class Range , class F > |
constexpr void | forEach (Range &&range, F &&f) |
| Range based for loop.
|
template<class Range , class T , class F > |
T | accumulate (Range &&range, T value, F &&f) |
| Accumulate values.
|
template<class Condition , class IfFunc , class ElseFunc > |
| decltype (auto) ifElse(const Condition &condition |
| A conditional expression.
|
class IfFunc void | ifElse (const Condition &condition, IfFunc &&ifFunc) |
template<class T1 , class T2 > |
constexpr auto | equals (T1 &&t1, T2 &&t2) |
| Equality comparison.
|
template<class Cases , class Value , class Branches , class ElseBranch > |
constexpr | decltype (auto) switchCases(const Cases &cases |
| Switch statement.
|
class Branches constexpr void | switchCases (const Cases &cases, const Value &value, Branches &&branches) |
Variables |
IfFunc && | ifFunc |
constexpr const Value & | value |
constexpr const Value Branches && | branches |
template<class Cases , class Value , class Branches , class ElseBranch >
constexpr Dune::Hybrid::decltype |
( |
auto |
|
) |
const [inline] |
Switch statement.
- Template Parameters:
-
| Cases | Type of case range |
| Value | Type of value to check against the cases |
| Branches | Type of branch function |
| ElseBranch | Type of branch function |
- Parameters:
-
| cases | A range of cases to check for |
| value | The value to check against the cases |
| branches | A callback that will be executed with matching entry from case list |
| elseBranch | A callback that will be executed if no other entry matches |
Value is checked against all entries of the given range. If one matches, then branches is executed with the matching value as single argument. If the range is an std::integer_sequence, the value is passed as std::integral_constant. If non of the entries matches, then elseBranch is executed without any argument.
Notice that this short circuits, e.g., if one case matches, the others are no longer evaluated.
The return value will be deduced from the else branch.