Alternate (much portable, but recursive) solution, based on this answer, not even "Pre C++17", but maybe even "Pre C++11" :) (Works even in Arduino, without any dependencies)
template <typename ... Args>
struct count_bytes;
template <>
struct count_bytes<> {
constexpr static size_t value = 0u;
};
template <typename T, typename... Args>
struct count_bytes<T, Args...> {
constexpr static size_t value = sizeof(T) + count_bytes<Args...>::value;
};
// ----------------------------------------------------------------
// Compile-time testing
static_assert(count_bytes<int8_t, int16_t>::value == 3, "Test failed");
static_assert(count_bytes<int8_t, int16_t, int32_t>::value == 7, "Test failed");
static_assert(count_bytes<float, float, float, double>::value == 20, "Test failed");
// Test for known-size fixed array
static_assert(count_bytes<int, int[2]>::value == 12, "Test failed");
// Attention: sizeof(void) works for C, but not for C++. Reference: https://stackoverflow.com/a/1666232/
// static_assert(count_bytes<void>::value == 1, "Test failed");