2015-04-18 93 views
8

讀取article,當我遇到一個代碼來了,作者指出:「C++標準庫提供以下類型定義:」以下typedef在chrono :: duration中的含義是什麼?

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 >= 64 bits是什麼意思?這是否意味着signed int減去type?如果是的話,你如何解釋?

+1

[CPPReference](http://en.cppreference.com/w/cpp/chrono/duration)是C++的一個很好的參考,在這種情況下,以更清晰的格式顯示這些typedefs。 – Barry

回答

15

這不是實際的代碼;它只能說明(以「自然」語言)符合實現中模板的類型參數所需的內容。所以「signed int-type> = 64 bits」是指「至少有64位的任何有符號整數類型」,但字母較少。

+0

哦,我明白了!非常感謝你! – Allanqunzi

相關問題