std::ispow2 (3) - Linux Manuals

std::ispow2: std::ispow2

NAME

std::ispow2 - std::ispow2

Synopsis


Defined in header <bit>
template< class T > (since C++20)
constexpr bool ispow2(T x) noexcept;


Checks if x is an integral power of two.
This overload only participates in overload resolution if T is an unsigned integer type (that is, unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, or an extended unsigned integer type).

Return value


true if x is an integral power of two; otherwise false.

Example


 This section is incomplete
 Reason: no example