operator==, !=, <, <=, >, >= (std::experimental::optional)
From cppreference.net
<
cpp
|
experimental
|
optional
|
Definido en el encabezado
<experimental/optional>
|
||
|
Comparar dos objetos
optional
|
||
|
template
<
class
T
>
constexpr bool operator == ( const optional < T > & lhs, const optional < T > & rhs ) ; |
(1) | (library fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator ! = ( const optional < T > & lhs, const optional < T > & rhs ) ; |
(2) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator < ( const optional < T > & lhs, const optional < T > & rhs ) ; |
(3) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator <= ( const optional < T > & lhs, const optional < T > & rhs ) ; |
(4) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator > ( const optional < T > & lhs, const optional < T > & rhs ) ; |
(5) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator >= ( const optional < T > & lhs, const optional < T > & rhs ) ; |
(6) | (biblioteca de fundamentos TS) |
|
Comparar un objeto
optional
con un
nullopt
|
||
|
template
<
class
T
>
constexpr bool operator == ( const optional < T > & opt, std:: nullopt_t ) noexcept ; |
(7) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator == ( std:: nullopt_t , const optional < T > & opt ) noexcept ; |
(8) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator ! = ( const optional < T > & opt, std:: nullopt_t ) noexcept ; |
(9) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator ! = ( std:: nullopt_t , const optional < T > & opt ) noexcept ; |
(10) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator < ( const optional < T > & opt, std:: nullopt_t ) noexcept ; |
(11) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator < ( std:: nullopt_t , const optional < T > & opt ) noexcept ; |
(12) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator <= ( const optional < T > & opt, std:: nullopt_t ) noexcept ; |
(13) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator <= ( std:: nullopt_t , const optional < T > & opt ) noexcept ; |
(14) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator > ( const optional < T > & opt, std:: nullopt_t ) noexcept ; |
(15) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator > ( std:: nullopt_t , const optional < T > & opt ) noexcept ; |
(16) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator >= ( const optional < T > & opt, std:: nullopt_t ) noexcept ; |
(17) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator >= ( std:: nullopt_t , const optional < T > & opt ) noexcept ; |
(18) | (biblioteca fundamentals TS) |
|
Comparar un objeto
optional
con un
T
|
||
|
template
<
class
T
>
constexpr bool operator == ( const optional < T > & opt, const T & value ) ; |
(19) | (biblioteca fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator == ( const T & valor, const optional < T > & opt ) ; |
(20) | (library fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator ! = ( const optional < T > & opt, const T & value ) ; |
(21) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator ! = ( const T & value, const optional < T > & opt ) ; |
(22) | (biblioteca fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator < ( const optional < T > & opt, const T & value ) ; |
(23) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator < ( const T & value, const optional < T > & opt ) ; |
(24) | (biblioteca fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator <= ( const optional < T > & opt, const T & value ) ; |
(25) | (library fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator <= ( const T & value, const optional < T > & opt ) ; |
(26) | (biblioteca de fundamentos TS) |
|
template
<
class
T
>
constexpr bool operator > ( const optional < T > & opt, const T & value ) ; |
(27) | (biblioteca fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator > ( const T & value, const optional < T > & opt ) ; |
(28) | (biblioteca fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator >= ( const optional < T > & opt, const T & value ) ; |
(29) | (biblioteca fundamentals TS) |
|
template
<
class
T
>
constexpr bool operator >= ( const T & value, const optional < T > & opt ) ; |
(30) | (library fundamentals TS) |
Realiza operaciones de comparación en objetos
optional
.
1-6)
Compara dos objetos
optional
,
lhs
y
rhs
. Los valores contenidos se comparan (usando
operator
==
para
(1,2)
y
operator
<
para
(3-6)
) solo si tanto
lhs
como
rhs
contienen valores. En caso contrario,
-
-
- lhs se considera igual a rhs si, y solo si, tanto lhs como rhs no contienen un valor.
- lhs se considera menor que rhs si, y solo si, rhs contiene un valor y lhs no lo contiene.
-
7-18)
Compara
opt
con un
nullopt
. Equivalente a (1-6) cuando se compara con un
optional
que no contiene un valor.
19-30)
Compara
opt
con un
value
. Los valores se comparan (usando
operator
==
para
(19-22)
y
operator
<
para
(23-30)
) solo si
opt
contiene un valor. De lo contrario,
opt
se considera
menor que
value
.
Parámetros
| lhs, rhs, opt | - |
un objeto
optional
para comparar
|
| value | - | valor para comparar con el valor contenido |
| Requisitos de tipo | ||
-
T
debe cumplir con los requisitos de
EqualityComparable
para usar las sobrecargas (1,2).
|
||
Valor de retorno
1)
Si
bool
(
lhs
)
!
=
bool
(
rhs
)
, devuelve
false
.
De lo contrario, si
bool
(
lhs
)
==
false
(y por lo tanto
bool
(
rhs
)
==
false
también), devuelve
true
.
De lo contrario, retorna
*
lhs
==
*
rhs
.
2)
Devuelve
!
(
lhs
==
rhs
)
.
3)
Si
bool
(
rhs
)
==
false
retorna
false
.
De lo contrario, si
bool
(
lhs
)
==
false
, devuelve
true
.
En caso contrario, devuelve
*
x
<
*
y
.
4)
Devuelve
!
(
rhs
<
lhs
)
.
5)
Devuelve
rhs
<
lhs
.
6)
Devuelve
!
(
lhs
<
rhs
)
.
7,8)
Devuelve
!
opt
.
9,10)
Devuelve
bool
(
opt
)
.
11)
Devuelve
false
.
12)
Devuelve
bool
(
opt
)
.
13)
Devuelve
!
opt
.
14)
Devuelve
true
.
15)
Devuelve
bool
(
opt
)
.
16)
Devuelve
false
.
17)
Devuelve
true
.
18)
Devuelve
!
opt
.
19)
Devuelve
bool
(
opt
)
?
*
opt
==
value
:
false
.
20)
Devuelve
bool
(
opt
)
?
value
==
*
opt
:
false
.
21)
Devuelve
bool
(
opt
)
?
!
(
*
opt
==
value
)
:
true
.
22)
Devuelve
bool
(
opt
)
?
!
(
value
==
*
opt
)
:
true
.
23)
Devuelve
bool
(
opt
)
?
*
opt
<
value
:
true
.
24)
Devuelve
bool
(
opt
)
?
value
<
*
opt
:
false
.
25)
Devuelve
!
(
opt
>
value
)
.
26)
Devuelve
!
(
value
>
opt
)
.
27)
Devuelve
bool
(
opt
)
?
value
<
*
opt
:
false
.
28)
Devuelve
bool
(
opt
)
?
*
opt
<
value
:
true
.
29)
Devuelve
!
(
opt
<
value
)
.
30)
Devuelve
!
(
value
<
opt
)
.
Excepciones
1-6)
(ninguno)
19-30)
(ninguno)