【问题标题】:What does the following typedef mean in chrono::duration?以下 typedef 在 chrono::duration 中是什么意思?
【发布时间】:2015-04-18 19:20:38
【问题描述】:

我在阅读article时遇到了一段代码,作者指出“C++标准库提供了以下类型定义:”

namespace std {
namespace chrono {
   typedef duration<signed int-type >= 64 bits,nano>        nanoseconds;
   typedef duration<signed int-type >= 55 bits,micro>       microseconds;
   typedef duration<signed int-type >= 45 bits,milli>       milliseconds;
   typedef duration<signed int-type >= 35 bits>             seconds;
   typedef duration<signed int-type >= 29 bits,ratio<60>>   minutes;
   typedef duration<signed int-type >= 23 bits,ratio<3600>> hours;
   }
}

我的问题是signed int-type &gt;= 64 bits 是什么意思?这是否意味着signed int 减去type?如果是这样,您如何解释?

【问题讨论】:

  • CPPReference 是 C++ 的一个很好的参考,在这种情况下以更清晰的格式呈现这些 typedef。

标签: c++ chrono


【解决方案1】:

这不是实际代码;它仅说明(以“自然”语言)在兼容实现中模板的类型参数所需的内容。

所以“signed int-type >= 64 bits”的意思是“任何至少有 64 位的有符号整数类型”,但字母更少。

【讨论】:

  • 哦,我明白了!非常感谢!
猜你喜欢
  • 2012-03-29
  • 1970-01-01
  • 2011-04-28
  • 2023-03-10
  • 2014-04-22
  • 2016-09-21
  • 2023-03-18
相关资源
最近更新 更多