Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5980719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:50:28+00:00 2026-05-22T21:50:28+00:00

I currently have a variadic function which takes an arbitrary number of arguments of

  • 0

I currently have a variadic function which takes an arbitrary number of arguments of arbitrary types (duh), however, I want to restrict the types to ones which are POD only, and also the same size or smaller than that of a void*.

The void* check was easy, I just did this:

static_assert(sizeof...(Args) <= sizeof(PVOID), "Size of types must be <= memsize.");

However I can’t work out how to do the same for std::is_pod.

Is this possible to do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:50:29+00:00Added an answer on May 22, 2026 at 9:50 pm

    You can write a meta-function to determine if all are POD types:

    template <typename... Ts>
    struct all_pod;
    
    template <typename Head, typename... Tail>
    struct all_pod<Head, Tail...>
    {
        static const bool value = std::is_pod<Head>::value && all_pod<Tail...>::value;
    };
    
    template <typename T>
    struct all_pod<T>
    {
        static const bool value = std::is_pod<T>::value;
    };
    

    then

    static_assert( all_pod<Args...>::value, "All types must be POD" );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an assembly program which is modeled after the hexdump system function
I currently have this in my document $(document).ready(function(){ $([href$='.html']).addClass('html'); $([href$='.pdf']).addClass('pdf'); }); which styles any
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
Possible Duplicate: C/C++: How to make a variadic macro (variable number of arguments) Just
Currently have this to get a value from the registry in TSQL. However, I
I want to have generalised email templates. Currently I have multiple email templates with
We currently have a Lookup table which contains a set of possible choices for
I currently have the following script: http://jsfiddle.net/oshirowanen/mnXdv/ Which works fine, i.e. if a click
I currently have a Rails app in which users of different ranks can upload
I currently have git and virtualenv set up in a way which exactly suits

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.