Argon 0.1.0
Loading...
Searching...
No Matches
argon::CondMonad< VectorType, ValueType > Class Template Reference

The result of if_(...) and each else_if_(...): a value chosen per lane by a chain of conditions. More...

#include <argon.hpp>

Public Member Functions

ace CondMonad (predicate_type condition, ValueType value)
 Start a chain: value where condition holds.
ace predicate_type condition () const
 The lanes some condition in the chain has claimed so far.
ace ValueType value () const
 The values chosen so far; lanes no condition has claimed are unspecified until else_.
ace CondMonad else_if_ (predicate_type new_condition, ValueType new_value) const
 new_value in the lanes where new_condition holds and no earlier condition did.
ace CondMonad else_if_ (predicate_type new_condition, scalar_type new_value) const
 new_value in the lanes where new_condition holds and no earlier condition did.
template<std::invocable FunctionType>
ace CondMonad else_if_ (predicate_type new_condition, FunctionType func) const
 new_value in the lanes where new_condition holds and no earlier condition did.
ace ValueType else_ (ValueType new_value) const
 new_value in the lanes no condition claimed; ends the chain.
ace ValueType else_ (scalar_type new_value) const
 new_value in the lanes no condition claimed; ends the chain.
template<std::invocable FunctionType>
ace ValueType else_ (FunctionType func) const
 new_value in the lanes no condition claimed; ends the chain.

Detailed Description

template<typename VectorType, typename ValueType>
requires (ValueType::lanes == Predicate<VectorType>::lanes)
class argon::CondMonad< VectorType, ValueType >

The result of if_(...) and each else_if_(...): a value chosen per lane by a chain of conditions.

Template Parameters
VectorTypeThe vector type the conditions were computed from.
ValueTypeThe Argon type of the values being chosen.

Lanes take the value of the first condition that holds for them, as in an if / else-if chain; else_ supplies the value for lanes where none held and ends the chain. Every branch is evaluated (see ternary).

Member Function Documentation

◆ else_() [1/2]

template<typename VectorType, typename ValueType>
template<std::invocable FunctionType>
ace ValueType argon::CondMonad< VectorType, ValueType >::else_ ( FunctionType func) const
inline

new_value in the lanes no condition claimed; ends the chain.

◆ else_() [2/2]

template<typename VectorType, typename ValueType>
ace ValueType argon::CondMonad< VectorType, ValueType >::else_ ( scalar_type new_value) const
inline

new_value in the lanes no condition claimed; ends the chain.

◆ else_if_() [1/2]

template<typename VectorType, typename ValueType>
template<std::invocable FunctionType>
ace CondMonad argon::CondMonad< VectorType, ValueType >::else_if_ ( predicate_type new_condition,
FunctionType func ) const
inline

new_value in the lanes where new_condition holds and no earlier condition did.

◆ else_if_() [2/2]

template<typename VectorType, typename ValueType>
ace CondMonad argon::CondMonad< VectorType, ValueType >::else_if_ ( predicate_type new_condition,
scalar_type new_value ) const
inline

new_value in the lanes where new_condition holds and no earlier condition did.


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