Top "Static-assert" questions

An assertion statement that is verified at the compilation time.

Integrate type name in static_assert output?

I like to give helpful errors / messages, and I also want to do so for my static_asserts. The problem …

c++ templates c++11 custom-errors static-assert
constexpr if and static_assert

P0292R1 constexpr if has been included, on track for C++17. It seems useful (and can replace use of SFINAE), …

c++ templates constexpr c++17 static-assert
Display integer at compile time in static_assert()

Here is a simplified version of what I'm trying to do enum First { a, b, c, nbElementFirstEnum, }; enum Second { a, …

c++ macros c++11 integer static-assert
How to combine static_assert with sizeof and stringify?

Memory usage is quite critical in my application. Therefore I have specific asserts that check for the memory size at …

c++ visual-studio-2010 c++11 stringify static-assert
BOOST_STATIC_ASSERT without boost

Since boost is forbidden in a company I work for I need to implement its functionality in pure C++. I've …

c++ boost replace static-assert
static_assert - a way to dynamically customize error message

Is there a way to make static_assert's string being dynamically customized and then displayed? What I mean is something …

c++ c++11 static-assert
Can static_assert check if a type is a vector?

Can static_assert check if a type is a vector? IE, an int would raise the assertion, whereas a vector&…

c++ c++11 static-assert