you tell , i am asking
so I paste the code directly here:
#include <boost/core/demangle.hpp>
#include <iostream>
#include <tuple>
#include <typeinfo>
#include <utility>
template<typename input, std::size_t index = std::tuple_size_v<input> - 1>
void show() {
if constexpr (index != 0) {
show<input, index - 1>();
}
using type = std::tuple_element_t<index, input>;
std::cout << "The sizeof(" << boost::core::demangle(typeid(type).name()) << ") is : " << sizeof(type) << " bytes\n";
}
int main() {
using input = std::tuple<char, short, int, long, long long, float, double, long double, bool>;
show<input>();
}
If you input types by a single tuple, it is easy as above.