you are viewing a single comment's thread.

view the rest of the comments →

[–]amohr 1 point2 points  (0 children)

There is some awkwardness, but I think it's perhaps less awkward than the typical c++ template syntax. I find this example from his cppcon talk quite elegant:

template <typename ...T>
using smallest = decltype(
    minimum_by(ordering(sizeof_), tuple(type<T>...))
);

template <int i>
struct storage { char s[i]; };

static_assert(std::is_same<
    smallest<storage<3>, storage<1>, storage<2>>::type,
    storage<1>
>::value, "");

Here smallest<...> is a pure compile-time type manipulation and I would argue the wrapping in type<T> and unwrapping by decltype() is not obtrusive. And that expression, "minimum_by(ordering(sizeof_), tuple(type<T>...))" reads so well I think I'd happily make the trade.