名前空間
変種
操作

std::chrono::duration::operator+=, -=, *=, /=, %=

提供: cppreference.com
< cpp‎ | chrono‎ | duration

 
 
ユーティリティライブラリ
支援を入力します (basic types, RTTI, type traits)
動的なメモリ管理
エラー処理
プログラムユーティリティ
可変個引数関数
日付と時刻
関数オブジェクト
initializer_list(C++11)
bitset
hash(C++11)
関係演算子
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
ペアとタプル
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
フォワード、スワップ、および移動
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
 
std::chrono::duration
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
duration::duration
duration::operator=
duration::count
duration::zero
duration::min
duration::max
duration::operator+
duration::operator-
duration::operator++
duration::operator--
duration::operator+=
duration::operator-=
duration::operator*=
duration::operator/=
duration::operator%=
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
common_type
operator+
operator-
operator*
operator/
operator%
operator==
operator!=
operator<
operator<=
operator>
operator>=
duration_cast
ヘルパークラス
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
treat_as_floating_point
duration_values
 
duration& operator+=(const duration& d);
(1)
duration& operator-=(const duration& d);
(2)
duration& operator*=(const rep& rhs);
(3)
duration& operator/=(const rep& rhs);
(4)
duration& operator%=(const rep& rhs);
(5)
duration& operator%=(const duration& rhs);
(6)
同じ期間で2つの期間の間、または期間およびティック数の値との間の複合代入を行います.
Original:
Performs compound assignments between two durations with the same period or between a duration and a tick count value.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rep_このDurationオブジェクトの刻みの数を保持しているメンバ変数の場合は、
Original:
If rep_ is the member variable holding the number of ticks in this duration object,
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
rep_ += d.count(); return *this;に相当する
Original:
Equivalent to rep_ += d.count(); return *this;
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
rep_ -= d.count(); return *this;に相当する
Original:
Equivalent to rep_ -= d.count(); return *this;
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
rep_ *= rhs; return *this;に相当する
Original:
Equivalent to rep_ *= rhs; return *this;
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
rep_ /= rhs; return *this;に相当する
Original:
Equivalent to rep_ /= rhs; return *this;
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
rep_ %= rhs; return *this;に相当する
Original:
Equivalent to rep_ %= rhs; return *this;
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
rep_ %= d.count(); return *this;に相当する
Original:
Equivalent to rep_ %= d.count(); return *this;
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

d -
演算子の右側にある期間
Original:
duration on the right-hand side of the operator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rhs -
演算子の右側の刻みの数
Original:
number of ticks on the right-hand side of the operator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

変更後のこの期間を参照する
Original:
A reference to this duration after modification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <chrono>
#include <iostream>
 
int main()
{
    std::chrono::minutes m(11);
    m *= 2;
    m += std::chrono::hours(10); // hours implicitly convert to minutes
    std::cout << m.count() << " minutes equals "
              << std::chrono::duration_cast<std::chrono::hours>(m).count() 
              << " hours and ";
    m %= std::chrono::hours(1);
    std::cout << m.count() << " minutes\n";
}

Output:

622 minutes equals 10 hours and 22 minutes

[編集] も参照してください

インクリメントまたはデクリメントするティック数
Original:
increments or decrements the tick count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]
引数として期間との間で演算を実装しています
Original:
implements arithmetic operations with durations as arguments
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート) [edit]