Reputation: 2112
In other words, is std::atomic<int>
guaranteed to hold only a single int
value?
Upvotes: 12
Views: 1935
Reputation: 126462
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 ]
Upvotes: 18