名前空間
変種
操作

std::chrono::duration::duration

提供: 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
 
constexpr duration() = default;
(1)
duration(const duration&) = default;
(2)
template <class Rep2>
constexpr explicit duration(const Rep2& r);
(3)
template <class Rep2, class Period2>
constexpr duration(const duration<Rep2, Period2>& d);
(4)
いくつかの任意のデータソースのいずれかから新しいdurationを構築し.
Original:
Constructs a new duration from one of several optional data sources.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
デフォルトコンストラクタがデフォルト設定されます.
Original:
The default constructor is defaulted.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
コピーコンストラクタは(ティック数のビット単位のコピーを作成します)デフォルト設定されます.
Original:
The copy constructor is defaulted (makes a bitwise copy of 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.
3)
rチックとデュレーションを構築します。 Rep2場合は、このコンストラクタは唯一のオーバーロードの解決に関与していることに注意してください(引数の型)がrepに暗黙的に変換(この期間のダニの一種)と
Original:
Constructs a duration with r ticks. Note that this constructor only participates in overload resolution if Rep2 (the argument type) is implicitly convertible to rep (the type of this duration's ticks) and
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
@ @(つまり、整数ティック数と持続時間は、浮動小数点値から構築することはできませんが、浮動小数点のティック数と持続時間が整数値から構築することができる)
Original:
@@(that is, a duration with an integer tick count cannot be constructed from a floating-point value, but a duration with a floating-point tick count can be constructed from an integer value)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
dであるかのように、適切な期間およびティック数にstd::chrono::duration_cast<duration>(d).count()変換することにより、持続時間を構築します。変換時にトランケーションを防ぐために、このコンストラクタは、場合にのみ、オーバーロードの解決に参加しています
Original:
Constructs a duration by converting d to an appropriate period and tick count, as if by std::chrono::duration_cast<duration>(d).count(). In order to prevent truncation during conversion, this constructor only participates in overload resolution if:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
@ @又はこれを併科する
Original:
@@ or both:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
@ @(つまり、どちらかの期間が浮動小数点ticksを使用して、またはPeriod2がピリオドで割り切れます)
Original:
@@ (that is, either the duration uses floating-point ticks, or Period2 is exactly divisible by period)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] パラメータ

r -
ティック数
Original:
a tick count
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
d -
からコピーするための期間
Original:
a duration to copy from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

次のコードは、期間を構成する方法の例をいくつか(有効と無効の両方)を示しています
Original:
The following code shows several examples (both valid and invalid) of how to construct durations:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <chrono>
int main()
{
    std::chrono::hours h(1); // one hour
    std::chrono::milliseconds ms{3}; // 3 milliseconds
    std::chrono::duration<int, std::kilo> ks(3); // 3000 seconds
 
    // error: treat_as_floating_point<int>::value == false,
    // This duration allows whole tick counts only
//  std::chrono::duration<int, std::kilo> d3(3.5);
 
    // 30Hz clock using fractional ticks
    std::chrono::duration<double, std::ratio<1, 30>> hz30(3.5);
 
    // 3000 microseconds constructed from 3 milliseconds
    std::chrono::microseconds us = ms;
    // error: 1/1000000 is not divisible by 1/1000
//  std::chrono::milliseconds ms2 = us
}


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

内容が割り当てられます
Original:
assigns the contents
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数) [edit]