Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1 KB

File metadata and controls

59 lines (44 loc) · 1 KB

operator+

  • chrono[meta header]
  • std::chrono[meta namespace]
  • duration[meta class]
  • function[meta id-type]
  • cpp11[meta cpp]
constexpr common_type_t<duration> operator+() const;
  • common_type_t[link /reference/chrono/common_type.md]

概要

正の符号。

なにもせず、*thisをそのまま返す。

戻り値

common_type_t<duration>(*this)

#include <iostream>
#include <chrono>

using std::chrono::duration;
using std::nano;

int main()
{
  duration<int, nano> d1(2);

  duration<int, nano> d2 = +d1;

  std::cout << d1.count() << std::endl;
  std::cout << d2.count() << std::endl;
}
  • nano[link /reference/ratio/si_prefix.md]
  • count()[link count.md]

出力

2
2

バージョン

言語

  • C++11

処理系

参照