Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the following typedef mean in chrono::duration?

Tags:

c++

chrono

I came across a code when reading an article, the author states that "the C++ standard library provides the following type definitions:"

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;
   }
}

My question is what does signed int-type >= 64 bits mean? Does it mean signed int minus type? And if so how do you interpret that?

like image 945
Allanqunzi Avatar asked Apr 18 '15 19:04

Allanqunzi


1 Answers

It's not actual code; it only illustrates (in "natural" language) what is required for the template's type parameter in a compliant implementation.

So "signed int-type >= 64 bits" means "any signed integer type with at least 64 bits", but with fewer letters.

like image 181
molbdnilo Avatar answered Oct 06 '22 00:10

molbdnilo