【问题标题】:Is it guaranteed that sizeof(std::atomic<integer type>) == sizeof(integer type)?是否保证 sizeof(std::atomic<integer type>) == sizeof(integer type)?
【发布时间】:2013-03-16 17:37:17
【问题描述】:

换句话说,std::atomic&lt;int&gt; 是否保证只保存一个 int 值?

【问题讨论】:

    标签: c++ c++11 atomic


    【解决方案1】:

    没有。

    根据 C++11 标准的第 29.5/9 段:

    [ 注意:原子特化的表示不需要与其对应的大小相同 参数类型。专业化应尽可能具有相同的大小,因为这样可以减少工作量 需要移植现有代码。 ——尾注]

    【讨论】:

      猜你喜欢
      • 2012-10-21
      • 2020-02-18
      • 2019-10-18
      • 1970-01-01
      • 2012-02-13
      • 1970-01-01
      • 2012-01-08
      • 2012-09-19
      • 1970-01-01
      相关资源
      最近更新 更多