std::chrono::duration::operator+(unary), std::chrono::duration::operator-(unary)
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> constexpr duration operator+() const; |
(1) | |
constexpr duration operator-() const; |
(2) | |
Met en œuvre unaires moins unaire plus et pour les durées .
Original:
Implements unary plus and unary minus for the durations.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Si
rep_ est une variable membre qui détient le nombre de tiques dans un objet durée Original:
If
rep_ is a member variable holding the number of ticks in a duration object, The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
1)
Equivalent à
return *this;Original:
Equivalent to
return *this;The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
Equivalent à
return duration(-rep_);Original:
Equivalent to
return duration(-rep_);The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Paramètres
(Aucun)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Retourne la valeur
1)
une copie de cet objet durée
Original:
a copy of 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.
You can help to correct and verify the translation. Click here for instructions.
2)
une copie de cet objet durée, avec le nombre de graduations inversées
Original:
a copy of this duration object, with the number of ticks negated
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exemple
#include <chrono>
#include <iostream>
int main()
{
std::chrono::seconds s1(10);
std::chrono::seconds s2 = -s1;
std::cout << "negated 10 seconds are " << s2.count() << " seconds\n";
}
Résultat :
negated 10 seconds are -10 seconds
Voir aussi
incrémente ou décrémente le nombre de cycles 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. (fonction membre publique) | |
met en œuvre des opérations arithmétiques avec des durées comme arguments 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. (fonction générique) |