48 return sout <<
"_" << N;
60 std::ostream &
operator<<(std::ostream &sout, std::reference_wrapper<T>
const &wrapper) {
61 return sout << wrapper.get();
65 inline std::ostream &variadic_print(std::ostream &sout) {
return sout; }
77 template <
typename T0,
typename... Ts>
78 std::ostream &variadic_print(std::ostream &sout, T0 &&t0, Ts &&...ts) {
79 sout << std::forward<T0>(t0) << (
sizeof...(Ts) > 0 ?
", " :
"");
80 variadic_print(sout, std::forward<Ts>(ts)...);
87 template <
int C,
int N>
88 struct print_tuple_impl {
89 template <
typename Tuple>
90 void operator()(std::ostream &sout, Tuple
const &t) {
91 sout << std::get<C>(t) << (C != N - 1 ?
", " :
"");
92 print_tuple_impl<C + 1, N>()(sout, t);
98 struct print_tuple_impl<N, N> {
99 template <
typename Tuple>
100 void operator()(std::ostream &, Tuple
const &) {}
113 template <
typename Tuple>
115 detail::print_tuple_impl<1, std::tuple_size_v<Tuple>>()(sout, t);
128 template <
typename Tag,
typename L>
129 requires std::is_base_of_v<tags::unary_op, Tag>
131 return sout <<
"(" << Tag::name() <<
" " << std::get<0>(ex.
childs) <<
")";
144 template <
typename Tag,
typename L,
typename R>
145 requires std::is_base_of_v<tags::binary_op, Tag>
147 return sout <<
"(" << std::get<0>(ex.
childs) <<
" " << Tag::name() <<
" " << std::get<1>(ex.
childs) <<
")";
160 template <
typename C,
typename A,
typename B>
162 return sout <<
"(" << std::get<0>(ex.
childs) <<
" ? " << std::get<1>(ex.
childs) <<
" : " << std::get<2>(ex.
childs) <<
")";
173 template <
typename... Ts>
189 template <
typename... Ts>
205 template <
typename T>
207 return sout << std::get<0>(ex.
childs);
218 template <
typename T>
220 return sout << std::get<0>(ex.
childs) <<
"[" << std::get<1>(ex.
childs) <<
"]";
231 template <
typename T>
233 return sout <<
"-(" << std::get<0>(ex.
childs) <<
")";
245 template <
typename Expr,
int... Is>
247 sout <<
"lazy function : (";
249 return sout <<
") --> " << f.
obj;
Includes all relevant headers for the core clef library.
__inline__ void operator<<(expr< tags::function, F, placeholder< Is >... > const &ex, RHS &&rhs)
Assign values to the underlying object of a lazy function call expression.
std::ostream & print_tuple(std::ostream &sout, Tuple const &t)
Print a std::tuple to std::ostream.
Single node of the expression tree.
childs_t childs
Child nodes of the current expression node.
Helper struct to simplify calls to nda::clef::eval.
T obj
Object to be evaluated.
A placeholder is an empty struct, labelled by an int.