最終更新日時(UTC):
が更新

履歴 編集

function
<chrono>

std::chrono_literals::minリテラル(C++14)

namespace std {

inline namespace literals {
inline namespace chrono_literals {
  constexpr chrono::minutes
    operator "" min(unsigned long long x);             // (1)

  constexpr chrono::duration<unspecified, ratio<60,1>>
    operator "" min(long double x);                    // (2)
}}

namespace chrono {
using namespace literals::chrono_literals;
} // namespace chrono

}  // namespace std

概要

分単位の値を表すdurationクラスのリテラル。

  • (1) : 整数型の分リテラル
  • (2) : 浮動小数点型の分リテラル

戻り値

  • (1) : chrono::minutes(x)
  • (2) : chrono::duration<unspecified, ratio<60,1>>(x)

#include <iostream>
#include <chrono>

int main()
{
  using namespace std::literals::chrono_literals;

  auto minutes_i = 3min;   // 整数型の3分
  auto minutes_f = 3.1min; // 浮動小数点型の3.1分

  std::cout << minutes_i.count() << std::endl;
  std::cout << minutes_f.count() << std::endl;
}

出力

3
3.1

バージョン

言語

  • C++14

処理系

参照