In C++17 you can use a fold expression:

template<typename... Others>
constexpr size_t getSize() {
    return (sizeof(Others) + ...);
}

Demo

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top