MGIS 3.1.0
Loading...
Searching...
No Matches
BinaryOperation.ixx File Reference

Implementation of the BinaryOperationModifier and BinaryOperationModifier2 classes and of the helpers declared in MGIS/Function/BinaryOperation.hxx. More...

Namespaces

namespace  mgis
 the namespace mgis encloses all the MGIS project.

Functions

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents (const BinaryOperationModifier< CallableType, FirstEvaluatorType, SecondEvaluatorType > &)
 return the number of components of the values returned by a binary operation
template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents (const BinaryOperationModifier2< CallableType, FirstEvaluatorType, SecondEvaluatorType > &)
 return the number of components of the values returned by a binary operation which does not store its callable object
template<typename CallableType>
MGIS_HOST_DEVICE constexpr auto mgis::function::internals::binary_operation_modifier2 (CallableType)
 create a helper from a callable object which is only used to deduce the type of the binary operation
template<typename CallableType, typename SecondEvaluatorType>
requires (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)
MGIS_HOST_DEVICE constexpr auto mgis::function::binary_operation (CallableType &&, SecondEvaluatorType &&)
 partially apply a binary operation to the evaluator of its second argument
template<typename CallableType, typename FirstEvaluatorType, typename SecondEvaluatorType>
requires ((EvaluatorConcept<std::decay_t<FirstEvaluatorType>>)&& // (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)&& // (std::invocable< std::decay_t<CallableType>, evaluator_result<std::decay_t<FirstEvaluatorType>>, evaluator_result<std::decay_t<SecondEvaluatorType>>>))
constexpr auto mgis::function::binary_operation (CallableType &&c, FirstEvaluatorType &&e1, SecondEvaluatorType &&e2)
 applies the operation to the two given evaluators

Detailed Description

Implementation of the BinaryOperationModifier and BinaryOperationModifier2 classes and of the helpers declared in MGIS/Function/BinaryOperation.hxx.

Author
Thomas Helfer
Date
11/05/2025

Function Documentation

◆ binary_operation() [1/2]

template<typename CallableType, typename SecondEvaluatorType>
requires (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)
MGIS_HOST_DEVICE constexpr auto mgis::function::binary_operation ( CallableType && c,
SecondEvaluatorType && e2 )
constexpr

partially apply a binary operation to the evaluator of its second argument

creates a binary_operation_modifier from the callable object and applies it to the given evaluator, which is the evaluator of the second argument of the operation

The returned modifier can be applied to the evaluator of the first argument using operator|, as in e1 | binary_operation(c, e2).

Template Parameters
CallableTypetype of the binary operation, which may be a qualified type
SecondEvaluatorTypetype of the evaluator of the second argument, which may be a qualified type
Parameters
[in]cbinary operation, a copy of it is stored in the modifier
[in]e2evaluator used to compute the second argument
Returns
a internals::BinaryOperatorCurrying object

◆ binary_operation() [2/2]

template<typename CallableType, typename FirstEvaluatorType, typename SecondEvaluatorType>
requires ((EvaluatorConcept<std::decay_t<FirstEvaluatorType>>)&& // (EvaluatorConcept<std::decay_t<SecondEvaluatorType>>)&& // (std::invocable< std::decay_t<CallableType>, evaluator_result<std::decay_t<FirstEvaluatorType>>, evaluator_result<std::decay_t<SecondEvaluatorType>>>))
auto mgis::function::binary_operation ( CallableType && c,
FirstEvaluatorType && e1,
SecondEvaluatorType && e2 )
constexpr

applies the operation to the two given evaluators

apply a binary operation to the values returned by two evaluators

◆ binary_operation_modifier2()

template<typename CallableType>
MGIS_HOST_DEVICE constexpr auto mgis::function::internals::binary_operation_modifier2 ( CallableType )
constexpr

create a helper from a callable object which is only used to deduce the type of the binary operation

the argument is only used to deduce the type of the binary operation

Template Parameters
CallableTypetype of the binary operation, which must be trivially default constructible
Parameters
[in]ccallable object which is discarded, as the operation is recreated when the values are computed
Returns
a stateless helper of type binary_operation_modifier2_impl<CallableType>

◆ getNumberOfComponents() [1/2]

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents ( const BinaryOperationModifier2< CallableType, FirstEvaluatorType, SecondEvaluatorType > & e)
nodiscardconstexpr

return the number of components of the values returned by a binary operation which does not store its callable object

forwards the call to the getNumberOfComponents member

Template Parameters
CallableTypetype of the binary operation
FirstEvaluatorTypetype of the evaluator used to compute the first argument of the operation
SecondEvaluatorTypetype of the evaluator used to compute the second argument of the operation
Parameters
[in]ebinary operation
Returns
number of components of the values returned by the operation

◆ getNumberOfComponents() [2/2]

template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
MGIS_HOST_DEVICE constexpr mgis::size_type mgis::function::getNumberOfComponents ( const BinaryOperationModifier< CallableType, FirstEvaluatorType, SecondEvaluatorType > & e)
nodiscardconstexpr

return the number of components of the values returned by a binary operation

forwards the call to the getNumberOfComponents member

Template Parameters
CallableTypetype of the binary operation
FirstEvaluatorTypetype of the evaluator used to compute the first argument of the operation
SecondEvaluatorTypetype of the evaluator used to compute the second argument of the operation
Parameters
[in]ebinary operation
Returns
number of components of the values returned by the operation