mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-15 16:36:03 +08:00
27 lines
422 B
Markdown
27 lines
422 B
Markdown
---
|
|
title: "static assert"
|
|
---
|
|
|
|
{{< callout type="info">}}
|
|
Header: `static_assert.h`
|
|
{{< /callout >}}
|
|
|
|
## Macro
|
|
```cpp
|
|
ETL_STATIC_ASSERT
|
|
```
|
|
Either maps on to the built-in `static_assert` or supplies a suitable definition.
|
|
|
|
```cpp
|
|
ETL_STATIC_ASSERT(condition, message);
|
|
```
|
|
|
|
## Example
|
|
```cpp
|
|
template <typename T>
|
|
void Do_This(T value)
|
|
{
|
|
ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Not an integral type");
|
|
}
|
|
```
|