Document operator<<

This commit is contained in:
Peter Dimov
2021-09-15 03:53:13 +03:00
parent 2da13befd7
commit 09ec260780
2 changed files with 38 additions and 17 deletions

View File

@ -13,6 +13,7 @@ https://www.boost.org/LICENSE_1_0.txt
* Added `<boost/variant2.hpp>`.
* Added `unsafe_get<I>`.
* Added `visit_by_index`.
* Added `operator<<`.
## Changes in 1.76.0

View File

@ -144,6 +144,17 @@ template<class... T>
template<class... T>
constexpr bool operator>=(const variant<T...>& v, const variant<T...>& w);
// stream insertion (extension)
template<class Ch, class Tr, class... T>
std::basic_ostream<Ch, Tr>&
operator<<( std::basic_ostream<Ch, Tr>& os, variant<T...> const& v );
// swap
template<class... T>
void swap(variant<T...>& v, variant<T...>& w) noexcept( /*see below*/ );
// visit
template<class R = /*unspecified*/, class F, class... V>
@ -165,11 +176,6 @@ constexpr bool operator>(monostate, monostate) noexcept { return false; }
constexpr bool operator<=(monostate, monostate) noexcept { return true; }
constexpr bool operator>=(monostate, monostate) noexcept { return true; }
// swap
template<class... T>
void swap(variant<T...>& v, variant<T...>& w) noexcept( /*see below*/ );
// bad_variant_access
class bad_variant_access;
@ -880,6 +886,32 @@ template<class... T>
Returns: ::
`w \<= v`.
### Stream Insertion (extension)
```
template<class Ch, class Tr, class... T>
std::basic_ostream<Ch, Tr>&
operator<<( std::basic_ostream<Ch, Tr>& os, variant<T...> const& v );
```
[none]
* {blank}
+
Requires: ::
`sizeof...(T) != 0`.
Returns: ::
`os << get<I>(v)`, where `I` is `v.index()`.
### swap
```
template<class... T>
void swap(variant<T...>& v, variant<T...>& w) noexcept( /*see below*/ );
```
[none]
* {blank}
+
Effects: ::
Equivalent to `v.swap(w)`.
### visit
```
@ -914,18 +946,6 @@ Remarks: :: If `R` is given explicitly, as in `visit_by_index<int>`, the return
of `Fi` to the corresponding variant alternatives must have the same return type
for this deduction to succeed.
### swap
```
template<class... T>
void swap(variant<T...>& v, variant<T...>& w) noexcept( /*see below*/ );
```
[none]
* {blank}
+
Effects: ::
Equivalent to `v.swap(w)`.
### bad_variant_access
```