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 874105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:03:11+00:00 2026-05-15T11:03:11+00:00

This syntax was used as a part of an answer to this question :

  • 0

This syntax was used as a part of an answer to this question:

template <bool>
struct static_assert;

template <>
struct static_assert<true> {}; // only true is defined

#define STATIC_ASSERT(x) static_assert<(x)>()

I do not understand that syntax. How does it work?

Suppose I do

STATIC_ASSERT(true);

it gets converted to

static_assert<true>();

Now what?

  • 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-15T11:03:12+00:00Added an answer on May 15, 2026 at 11:03 am
    STATIC_ASSERT(true);
    

    indeed means

    static_assert<true>();
    

    which evaluates to nothing. static_assert<true> is just an empty structure without any members. static_assert<true>() creates an object of that structure and does not store it anywhere.

    This simply compiles and does nothing.

    On the other hand

    STATIC_ASSERT(false);
    

    means

    static_assert<false>();
    

    which results in compilation error. static_assert has no specialization for false. So a general form is used. But the general form is given as follows:

    template <bool>
    struct static_assert;
    

    which is just a declaration of a structure and not its definition. So static_assert<false>() causes compilation error as it tries to make an object of a structure which is not defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've used answer from this question: Django: making raw SQL query, passing multiple/repeated params?
I appreciate this is an amateurish question but I am not used to VB
This is probably a basic question, but I have never used this syntax before.
I occasionally see the list slice syntax used in Python code like this: newList
In SQL Server 2017, you can use this syntax, but not in earlier versions:
Each of these variables has an integer value. But this syntax is not valid
This is maybe a simple syntax question or possibly a best-practices question in terms
Sorry for my inaccurate syntax. New to this. I need to select part numbers
A previous stackoverflow question had this as part of its solution: $.text([this]) I've never
I've asked this question on Wikipedia's Reference Desk , but got no answer. On

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.