This solution checks only the minimal precondition, which is that a type supports `std::tuple_size<T>`. A more complete implementation turns out to be surprisingly complex, since a direct check likely requires compile-time reflection capabilities at the level of at least C++23 - `std::tuple_element<i,T>` typically implements limits checks, which interfere with the detection of empty structured types - the situation regarding `std::get<i>()` is even more complicated, since we might have to probe for ADL-based solutions, or member templates The check for minimal necessary precondition however allows us to single out std::tuple, std::array and our own structured types in compilation branching, which suffices to fulfils actual needs.
8.4 MiB
8.4 MiB
| The file is too large to be shown. |