Is it guaranteed that sizeof(std::atomic<integer type>) == sizeof(integer type)?

atomic, c++, c++11

Solution

No.

Per Paragraph 29.5/9 of the C++11 Standard:

[ Note: The representation of an atomic specialization need not have the same size as its corresponding argument type. Specializations should have the same size whenever possible, as this reduces the effort required to port existing code. —end note ]

Problem

In other words, is `std::atomic<int>` guaranteed to hold only a single `int` value?

Original source