> Thats all! Simple, isn’t it? Here’s std::decay in the Turbo way:
template< class T >
struct decay {
using U = tml::eval<std::remove_reference<T>>;
using type = tml::eval<
tml::conditional<
std::is_array<U>,
tml::eval<std::remove_extent<U>>*,
tml::conditional<
std::is_function<U>,
std::add_pointer<U>,
std::remove_cv<U>
>
>
>;
};
> I found it much more readable. What do you think?I think:
1. Programming in XML notation is starting to look good, suddenly.
2.
(def-compile-time-gizmo decay (x)
(let ((u (remove-reference x)))
(cond
((is-array u) (remove-extent u))
((is-function u) (add-pointer u))
(t (remove-cv u)))))
3. Why isn't tml::conditional just called tml::if, if it (evidently) only takes three arguments: expr, then, else?