Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
つまり、std::atomic<int>単一のint値のみを保持することが保証されていますか?
std::atomic<int>
int
いいえ。
C++11 標準のパラグラフ 29.5/9 によると:
[ 注: アトミック特殊化の表現は、対応する引数の型と同じサイズである必要はありません。特殊化は可能な限り同じサイズにする必要があります。これにより、既存のコードの移植に必要な労力が削減されます。—終わりのメモ]