26 #ifndef TILEDARRAY_TILE_OP_UNARY_WRAPPER_H__INCLUDED 27 #define TILEDARRAY_TILE_OP_UNARY_WRAPPER_H__INCLUDED 81 template <
typename Op>
101 template <
typename T>
135 return (perm_ ? op_(arg, perm_) : op_(arg) );
144 return (perm_ ? op_(arg, perm_) : op_(arg) );
155 template <
typename A,
156 std::enable_if_t<is_nonarray_lazy_tile_v<A>>* =
nullptr>
171 template <
typename A, std::enable_if_t<is_array_tile_v<A>>* =
nullptr>
181 auto op_consume = [
this](
eval_t<A>& arg) {
182 return op_.consume(arg);
185 return (perm_ ?
invoke(op_, std::move(cast_arg), perm_)
186 : (arg.is_consumable()
187 ?
invoke(op_consume, cast_arg)
188 :
invoke(op_, std::move(cast_arg))));
192 template <
typename A, std::enable_if_t<is_lazy_tile_v<A>>* =
nullptr>
202 auto op_consume = [
this](
eval_t<A>& arg) {
203 return op_.consume(arg);
207 invoke(op_, std::move(cast_arg), perm_) :
208 invoke(op_consume, cast_arg));
211 template <
typename A, std::enable_if_t<!is_lazy_tile_v<A>>* =
nullptr>
213 static_assert(std::is_same<std::decay_t<A>,
argument_type>::value,
214 "UnaryWrapper::consume(A&&): invalid argument type A");
215 return (perm_ ? op_(std::forward<A>(arg), perm_)
216 : op_.consume(std::forward<A>(arg)));
224 #endif // TILEDARRAY_TILE_OP_UNARY_WRAPPER_H__INCLUDED
auto invoke_cast(Arg &&arg)
auto consume(A &&arg) const
Consume a lazy tile.
result_type consume(A &&arg) const
UnaryWrapper< Op > UnaryWrapper_
Determine the object type used in the evaluation of tensor expressions.
static constexpr auto is_array_tile_v
Unary tile operation wrapper.
auto operator()(const argument_type &arg) const
Apply operator to arg and possibly permute the result.
Op::result_type result_type
The result tile type.
static constexpr auto is_nonarray_lazy_tile_v
auto operator()(argument_type &arg) const
Apply operator to arg and possibly permute the result.
typename eval_trait< std::decay_t< T > >::type eval_t
Op::argument_type argument_type
Argument type.
Detect tiles used by ArrayEvalImpl.
Permutation of a sequence of objects indexed by base-0 indices.
const Permutation & permutation() const
Permutation accessor.
UnaryWrapper(const Op &op, const Permutation &perm)
static constexpr bool is_consumable
Boolean value that indicates the argument can always be consumed.
UnaryWrapper(const UnaryWrapper_ &)=default
Detect lazy evaluation tiles.
auto operator()(A &&arg) const
Evaluate a lazy tile.
static constexpr auto is_lazy_tile_v
UnaryWrapper_ & operator=(const UnaryWrapper_ &)=default
UnaryWrapper(const Op &op)