Implementation of the BinaryOperationModifier and BinaryOperationModifier2 classes and of the helpers declared in MGIS/Function/BinaryOperation.hxx.
More...
|
| namespace | mgis |
| | the namespace mgis encloses all the MGIS project.
|
|
| 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
|
Implementation of the BinaryOperationModifier and BinaryOperationModifier2 classes and of the helpers declared in MGIS/Function/BinaryOperation.hxx.
- Author
- Thomas Helfer
- Date
- 11/05/2025
- Copyright
- (C) Copyright Thomas Helfer 2018. Use, modification and distribution are subject to one of the following licences:
- GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying file LGPL-3.0.txt)
- CECILL-C, Version 1.0 (See accompanying files CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
◆ 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
-
| CallableType | type of the binary operation, which may be a qualified type |
| SecondEvaluatorType | type of the evaluator of the second argument, which may be a qualified type |
- Parameters
-
| [in] | c | binary operation, a copy of it is stored in the modifier |
| [in] | e2 | evaluator 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
-
| CallableType | type of the binary operation, which must be trivially default constructible |
- Parameters
-
| [in] | c | callable 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>
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
-
| CallableType | type of the binary operation |
| FirstEvaluatorType | type of the evaluator used to compute the first argument of the operation |
| SecondEvaluatorType | type of the evaluator used to compute the second argument of the operation |
- Parameters
-
- Returns
- number of components of the values returned by the operation
◆ getNumberOfComponents() [2/2]
template<typename CallableType, EvaluatorConcept FirstEvaluatorType, EvaluatorConcept SecondEvaluatorType>
return the number of components of the values returned by a binary operation
forwards the call to the getNumberOfComponents member
- Template Parameters
-
| CallableType | type of the binary operation |
| FirstEvaluatorType | type of the evaluator used to compute the first argument of the operation |
| SecondEvaluatorType | type of the evaluator used to compute the second argument of the operation |
- Parameters
-
- Returns
- number of components of the values returned by the operation