Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::max_align_t

      From cppreference.com
      <cpp‎ |types
       
       
      Utilities library
       
       
      Defined in header<cstddef>
      typedef/* implementation-defined */ max_align_t;
      (since C++11)

      std::max_align_t is astandard-layoutTrivialType(until C++26)TriviallyCopyable type(since C++26) whosealignment requirement is at least as strict (as large) as that of every scalar type.

      std::is_trivially_default_constructible_v<std::max_align_t> istrue.

      Contents

      [edit]Notes

      Pointers returned by allocation functions such asstd::malloc are suitably aligned for any object, which means they are aligned at least as strictly asstd::max_align_t.

      [edit]Example

      Run this code
      #include <cstddef>#include <iostream> int main(){std::cout<< alignof(std::max_align_t)<<'\n';}

      Possible output:

      16

      [edit]References

      • C++23 standard (ISO/IEC 14882:2024):
      • 17.2.4 Sizes, alignments, and offsets [support.types.layout] (p: 504-505)
      • C++20 standard (ISO/IEC 14882:2020):
      • 17.2.4 Sizes, alignments, and offsets [support.types.layout] (p: 507-508)
      • C++17 standard (ISO/IEC 14882:2017):
      • 21.2.4 Sizes, alignments, and offsets [support.types.layout] (p: 479)
      • C++14 standard (ISO/IEC 14882:2014):
      • 18.2 Types [support.types] (p: 443-444)
      • C++11 standard (ISO/IEC 14882:2011):
      • 18.2 Types [support.types] (p: 454-455)

      [edit]See also

      alignof(C++11) queries alignment requirements of a type
      (operator)[edit]
      obtains the type's alignment requirements
      (class template)[edit]
      (C++11)
      checks if a type is a scalar type
      (class template)[edit]
      C documentation formax_align_t
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/types/max_align_t&oldid=178077"

      [8]ページ先頭

      ©2009-2025 Movatter.jp