std::bit_ceil
Min standard notice:
Header: <bit>
Calculates the smallest integral power of two that is not smaller than x.
# Declarations
template< class T >
constexpr T bit_ceil( T x );
(since C++20)
# Parameters
x: value of unsigned integer type
# Return value
The smallest integral power of two that is not smaller than x.
# Notes
Prior to P1956R1, the proposed name for this function template was ceil2.
# Example
#include <bit>
#include <bitset>
#include <iostream>
int main()
{
using bin = std::bitset<8>;
for (auto x{0U}; 0XA != x; ++x)
std::cout << "bit_ceil( " << bin(x) << " ) = "
<< bin(std::bit_ceil(x)) << '\n';
}