libstdc++
std::literals::chrono_literals Namespace Reference

Functions

template<char... _Digits>
constexpr chrono::hours operator""h ()
 
constexpr chrono::duration< long double, ratio< 3600, 1 > > operator""h (long double __hours)
 
template<char... _Digits>
constexpr chrono::minutes operator""min ()
 
constexpr chrono::duration< long double, ratio< 60, 1 > > operator""min (long double __mins)
 
template<char... _Digits>
constexpr chrono::milliseconds operator""ms ()
 
constexpr chrono::duration< long double, millioperator""ms (long double __msecs)
 
template<char... _Digits>
constexpr chrono::nanoseconds operator""ns ()
 
constexpr chrono::duration< long double, nanooperator""ns (long double __nsecs)
 
template<char... _Digits>
constexpr chrono::seconds operator""s ()
 
constexpr chrono::duration< long double > operator""s (long double __secs)
 
template<char... _Digits>
constexpr chrono::microseconds operator""us ()
 
constexpr chrono::duration< long double, microoperator""us (long double __usecs)
 

Detailed Description

ISO C++ 2014 namespace for suffixes for duration literals.

These suffixes can be used to create chrono::duration values with tick periods of hours, minutes, seconds, milliseconds, microseconds or nanoseconds. For example, std::chrono::seconds(5) can be written as 5s after making the suffix visible in the current scope. The suffixes can be made visible by a using-directive or using-declaration such as:

  • using namespace std::chrono_literals;
  • using namespace std::literals;
  • using namespace std::chrono;
  • using namespace std;
  • using std::chrono_literals::operator""s;

The result of these suffixes on an integer literal is one of the standard typedefs such as std::chrono::hours. The result on a floating-point literal is a duration type with the specified tick period and an unspecified floating-point representation, for example 1.5e2ms might be equivalent to chrono::duration<long double, chrono::milli>(1.5e2).

Function Documentation

◆ operator""h() [1/2]

template<char... _Digits>
constexpr chrono::hours std::literals::chrono_literals::operator""h ( )
constexpr

Literal suffix for durations of type std::chrono::hours

Definition at line 3194 of file chrono.

◆ operator""h() [2/2]

constexpr chrono::duration<long double, ratio<3600,1> > std::literals::chrono_literals::operator""h ( long double  __hours)
constexpr

Literal suffix for durations representing non-integer hours.

Definition at line 3188 of file chrono.

◆ operator""min() [1/2]

template<char... _Digits>
constexpr chrono::minutes std::literals::chrono_literals::operator""min ( )
constexpr

Literal suffix for durations of type std::chrono::minutes

Definition at line 3205 of file chrono.

◆ operator""min() [2/2]

constexpr chrono::duration<long double, ratio<60,1> > std::literals::chrono_literals::operator""min ( long double  __mins)
constexpr

Literal suffix for durations representing non-integer minutes.

Definition at line 3199 of file chrono.

◆ operator""ms() [1/2]

template<char... _Digits>
constexpr chrono::milliseconds std::literals::chrono_literals::operator""ms ( )
constexpr

Literal suffix for durations of type std::chrono::milliseconds

Definition at line 3227 of file chrono.

◆ operator""ms() [2/2]

constexpr chrono::duration<long double, milli> std::literals::chrono_literals::operator""ms ( long double  __msecs)
constexpr

Literal suffix for durations representing non-integer milliseconds.

Definition at line 3221 of file chrono.

◆ operator""ns() [1/2]

template<char... _Digits>
constexpr chrono::nanoseconds std::literals::chrono_literals::operator""ns ( )
constexpr

Literal suffix for durations of type std::chrono::nanoseconds

Definition at line 3249 of file chrono.

◆ operator""ns() [2/2]

constexpr chrono::duration<long double, nano> std::literals::chrono_literals::operator""ns ( long double  __nsecs)
constexpr

Literal suffix for durations representing non-integer nanoseconds.

Definition at line 3243 of file chrono.

◆ operator""s() [1/2]

template<char... _Digits>
constexpr chrono::seconds std::literals::chrono_literals::operator""s ( )
constexpr

Literal suffix for durations of type std::chrono::seconds

Definition at line 3216 of file chrono.

◆ operator""s() [2/2]

constexpr chrono::duration<long double> std::literals::chrono_literals::operator""s ( long double  __secs)
constexpr

Literal suffix for durations representing non-integer seconds.

Definition at line 3210 of file chrono.

◆ operator""us() [1/2]

template<char... _Digits>
constexpr chrono::microseconds std::literals::chrono_literals::operator""us ( )
constexpr

Literal suffix for durations of type std::chrono::microseconds

Definition at line 3238 of file chrono.

◆ operator""us() [2/2]

constexpr chrono::duration<long double, micro> std::literals::chrono_literals::operator""us ( long double  __usecs)
constexpr

Literal suffix for durations representing non-integer microseconds.

Definition at line 3232 of file chrono.