23namespace vctr::expressions
26template <
size_t extent,
class SrcType, std::invocable<ValueType<SrcType>> FunctionType>
27requires (! std::is_void_v<std::invoke_result<FunctionType, ValueType<SrcType>>>)
31 using value_type = std::invoke_result_t<FunctionType, ValueType<SrcType>>;
35 void applyRuntimeArgs (
const FunctionType& transformationFunction)
37 fn = transformationFunction;
40 VCTR_FORCEDINLINE
constexpr value_type operator[] (
size_t i)
const
46 using FnCopyType = std::conditional_t<std::copyable<FunctionType>, FunctionType, std::function<value_type (
ValueType<SrcType>)>>;
70 return makeTemplateExpressionChainBuilderWithRuntimeArgs<expressions::TransformedBy, std::remove_cvref_t<Fn>> (std::forward<Fn> (fn));
constexpr auto transformedBy(Fn &&fn)
Transforms all source elements by applying fn to them.
Definition: TransformedBy.h:68
The main namespace of the VCTR project.
Definition: Array.h:24
typename detail::ValueType< std::remove_cvref_t< T > >::Type ValueType
If T is an expression template, it equals its return type, if it's a type that defines value_type as ...
Definition: Traits.h:201
The base class to every expression template.
Definition: ExpressionTemplate.h:37