I am wondering if a `constexpr std::tuple` can be sorted at compile-time:

```cpp
template<typename T>
struct A{ T val; }; // a constexpr-enabled class

constexpr auto t = std::make_tuple( A<int>{3}, A<float>{1.f}, A<double>{2.0});
constexpr auto s = sort(t, [](auto&& v){return v.val; });

static_assert(std::is_same_v<std::tuple<A<float>,
                                        A<double>, 
                                        A<int>>,decltype(s)>, "Wups");

```

Is that possible, which building blocks are needed here (`std::sort` is `constexpr`) ?

It is (as far as I know) impossible to do that at run-time, since one cannot determine the type of the sorted tuple at runtime. I cannot see a way also if one would build a type-map of all permutations, the actual permutation is still only known at runtime.

Answer <https://stackoverflow.com/a/46006026/293195> 
gives some hints and it should work in compile-time, but how?