# std::integral

> C++ Atlas: `cppatlas.com/w/cpp/concepts/integral` | Source: https://en.cppreference.com/w/cpp/concepts/integral | Domain: Concepts | Standards: C++11, C++20

The concept integral<T> is satisfied if and only if T is an integral type.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <concepts>

template< class T >
concept integral = std::is_integral_v<T>; // (since C++20)
```

The concept `integral<T>` is satisfied if and only if `T` is an integral type.

### Example

```cpp
#include <concepts>
#include <iostream>

void print(std::integral auto i)
{
    std::cout << "Integral: " << i << '\n';
}

void print(auto x)
{
    std::cout << "Non-integral: " << x << '\n';
}

int main()
{
    std::cout << std::boolalpha;

    static_assert(std::integral<bool>);
    print(true);

    static_assert(std::integral<char>);
    print('o');

    static_assert(std::integral<int>);
    print(007);

    static_assert( ! std::integral<double> );
    print(2e2);

    static_assert( ! std::integral<decltype("")> );
    print("∫∫∫");
}
```

Output:

```text
Integral: true
Integral: o
Integral: 7
Non-integral: 200
Non-integral: ∫∫∫
```

### References

- C++23 standard (ISO/IEC 14882:2024):

  - 18.4.7 Arithmetic concepts [concepts.arithmetic]

- C++20 standard (ISO/IEC 14882:2020):

  - 18.4.7 Arithmetic concepts [concepts.arithmetic]

### See also

- [`is_integral`](https://en.cppreference.com/w/cpp/types/is_integral) (C++11): checks if a type is an integral type (class template)

---
Attribution: content from https://en.cppreference.com/w/cpp/concepts/integral (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.