名稱空間
變體
操作

標準庫標頭檔案 <bit> (C++20)

來自 cppreference.com
 
 
標準庫標頭檔案
通用工具
<any> (C++17)
<bitset>
<bit> (C++20)
<charconv> (C++17)
<expected> (C++23)
<format> (C++20)
<functional>
<optional> (C++17)
<tuple> (C++11)
<typeindex> (C++11)
<utility>
<variant> (C++17)
容器
<array> (C++11)
<deque>
<flat_map> (C++23)
<flat_set> (C++23)
<forward_list> (C++11)
<hive> (C++26)
<inplace_vector> (C++26)   
<list>
<map>
<mdspan> (C++23)
<queue>
<set>
<span> (C++20)
<stack>
<unordered_map> (C++11)
<unordered_set> (C++11)
<vector>
迭代器
<iterator>
Ranges
<generator> (C++23)
<ranges> (C++20)
演算法
<algorithm>
<numeric>
字串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文字處理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
數值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
時間
<chrono> (C++11)
<ctime>
C 相容性
<ccomplex> (C++11/17/20*)
<ciso646> (直到 C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此標頭檔案是 numeric 庫的一部分。

型別

指示標量型別的位元組序
(列舉) [編輯]

函式

(C++20)
將一種型別的物件表示重新解釋為另一種型別的物件表示
(函式模板) [編輯]
(C++23)
反轉給定整數值中的位元組
(函式模板) [編輯]
檢查一個數是否是 2 的整數次冪
(函式模板) [編輯]
(C++20)
查詢不小於給定值的最小 2 的整數冪
(函式模板) [編輯]
(C++20)
查詢不大於給定值的最大 2 的整數冪
(函式模板) [編輯]
(C++20)
查詢表示給定值所需的最小位數
(函式模板) [編輯]
(C++20)
計算按位左旋的結果
(函式模板) [編輯]
(C++20)
計算位右旋的結果
(函式模板) [編輯]
計算從最高有效位開始的連續 0 位的數量
(函式模板) [編輯]
計算從最高有效位開始的連續 1 位的數量
(函式模板) [編輯]
計算從最低有效位開始的連續 0 位的數量
(函式模板) [編輯]
從最低有效位開始,計算連續的 1 位數
(函式模板) [編輯]
(C++20)
計算無符號整數中 1 位的數量
(函式模板) [編輯]

[編輯] 提要

namespace std {
  // bit_cast
  template<class To, class From>
    constexpr To bit_cast(const From& from) noexcept;
 
  // byteswap
  template <class T>
    constexpr T byteswap(T value) noexcept;
 
  // integral powers of 2
  template<class T>
    constexpr bool has_single_bit(T x) noexcept;
  template<class T>
    constexpr T bit_ceil(T x);
  template<class T>
    constexpr T bit_floor(T x) noexcept;
  template<class T>
    constexpr int bit_width(T x) noexcept;
 
  // rotating
  template<class T>
    constexpr T rotl(T x, int s) noexcept;
  template<class T>
    constexpr T rotr(T x, int s) noexcept;
 
  // counting
  template<class T>
    constexpr int countl_zero(T x) noexcept;
  template<class T>
    constexpr int countl_one(T x) noexcept;
  template<class T>
    constexpr int countr_zero(T x) noexcept;
  template<class T>
    constexpr int countr_one(T x) noexcept;
  template<class T>
    constexpr int popcount(T x) noexcept;
 
  // endian
  enum class endian {
    little = /* see description */,
    big    = /* see description */,
    native = /* see description */
  };
}