44 template <
typename T,
typename... Pairs>
45 decltype(
auto)
eval(T
const &obj, Pairs &&...pairs);
54 template <
typename T,
typename... Pairs>
65 FORCEINLINE T
const &
operator()(T
const &t, Pairs &...)
const {
return t; }
75 template <
int N,
int... Is,
typename... Ts>
79 template <
size_t... Ps>
80 static constexpr int get_position_of_N(std::index_sequence<Ps...>) {
81 return ((Is == N ?
int(Ps) + 1 : 0) + ...) - 1;
85 static constexpr int N_position = get_position_of_N(std::make_index_sequence<
sizeof...(Is)>{});
92 static constexpr bool is_lazy = (N_position == -1);
103 auto &pair_N = std::get<N_position>(std::tie(pairs...));
106 if constexpr (std::is_lvalue_reference_v<
decltype(pair_N.rhs)>) {
109 return std::move(pair_N.rhs);
123 template <
typename T,
typename... Pairs>
135 FORCEINLINE
decltype(
auto)
operator()(std::reference_wrapper<T>
const &wrapper, Pairs
const &...pairs)
const {
136 return eval(wrapper.get(), pairs...);
147 template <
typename Tag,
typename... Childs,
typename... Pairs>
154 template <
size_t... Is>
155 [[nodiscard]] FORCEINLINE
decltype(
auto) eval_impl(std::index_sequence<Is...>,
expr<Tag, Childs...> const &ex, Pairs &...pairs)
const {
170 [[nodiscard]] FORCEINLINE
decltype(
auto)
operator()(
expr<Tag, Childs...>
const &ex, Pairs &...pairs)
const {
171 return eval_impl(std::make_index_sequence<
sizeof...(Childs)>(), ex, pairs...);
196 template <
typename T,
typename... Pairs>
197 FORCEINLINE
decltype(
auto)
eval(T
const &obj, Pairs &&...pairs) {
Provides a basic lazy expression type for the clef library.
__inline__ decltype(auto) eval(T const &obj, Pairs &&...pairs)
Generic function to evaluate expressions and other types.
__inline__ auto op_dispatch(std::true_type, Args &&...args)
Dispatch operations containing at least one lazy operand.
constexpr bool is_any_lazy
Constexpr variable that is true if any of the given types is lazy.
Macros used in the nda library.
Provides operations for the clef library.
Provides placeholders for the clef library.
Generic evaluator for types which do not have a specialized evaluator.
__inline__ T const & operator()(T const &t, Pairs &...) const
Evaluate the object and ignore all given nda::clef::pair objects.
static constexpr bool is_lazy
Constexpr variable that is true if the type T is lazy.
Single node of the expression tree.
childs_t childs
Child nodes of the current expression node.
A pair consisting of a placeholder and its assigned value.
A placeholder is an empty struct, labelled by an int.
Provides some utility functions and type traits for the CLEF library.