共用方式為


<cstddef>

包含 C 標準程式庫標頭 < stddef.h > ,並將相關聯的名稱新增至 std 命名空間。 包含此標頭可確保在命名空間中 std 宣告使用外部連結宣告的名稱。

注意

<cstddef > 包含類型 位元組 ,且不包含 類型 wchar_t

語法

#include <cstddef>

命名空間和宏

namespace std {
    using ptrdiff_t = see definition;
    using size_t = see definition;
    using max_align_t = see definition;
    using nullptr_t = decltype(nullptr);
}

#define NULL  // an implementation-defined null pointer constant
#define offsetof(type, member-designator)

參數

ptrdiff_t
實作定義的帶正負號整數類型,可以保存陣列物件中兩個注標的差異。

size_t
實作定義的不帶正負號的整數類型,足以包含任何物件位元組的大小。

max_align_t
POD 類型,其對齊需求至少與每個純量類型一樣大,而且每個內容都支援其對齊需求。

nullptr_t
運算式類型的同義字 nullptrnullptr雖然無法擷取位址,但是可以取得另一個 nullptr_t 物件位址,也就是左值。

byte 類別

enum class byte : unsigned char {};

template <class IntType>
    constexpr byte& operator<<=(byte& b, IntType shift) noexcept;
    constexpr byte operator<<(byte b, IntType shift) noexcept;
    constexpr byte& operator>>=(byte& b, IntType shift) noexcept;
    constexpr byte operator>>(byte b, IntType shift) noexcept;

constexpr byte& operator|=(byte& left, byte right) noexcept;
constexpr byte operator|(byte left, byte right) noexcept;
constexpr byte& operator&=(byte& left, byte right) noexcept;
constexpr byte operator&(byte left, byte right) noexcept;
constexpr byte& operator^=(byte& left, byte right) noexcept;
constexpr byte operator^(byte left, byte right) noexcept;
constexpr byte operator~(byte b) noexcept;

template <class IntType>
    IntType to_integer(byte b) noexcept;

另請參閱

標頭檔參考
C++ 標準程式庫概觀
C++ 標準程式庫中的執行緒安全