From 73de83b8f7dd2b427d531db048ba3bfe74319505 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 2 Feb 2024 08:28:41 +0200 Subject: [PATCH] Update documentation --- doc/system/changes.adoc | 1 + doc/system/reference.adoc | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/doc/system/changes.adoc b/doc/system/changes.adoc index dce808c7..dd28182d 100644 --- a/doc/system/changes.adoc +++ b/doc/system/changes.adoc @@ -14,6 +14,7 @@ https://www.boost.org/LICENSE_1_0.txt * The deprecated header `boost/system/cygwin_error.hpp` has been removed. * The original and obsolete (32 bit) MinGW is no longer supported. MinGW-w64 (both 64 and 32 bit) is still supported. * `operator&` now works for `result` (by way of taking a nullary function.) +* Added `operator|=` for `result`. ## Changes in Boost 1.84 diff --git a/doc/system/reference.adoc b/doc/system/reference.adoc index 9327d0ee..5d62df4b 100644 --- a/doc/system/reference.adoc +++ b/doc/system/reference.adoc @@ -2618,6 +2618,41 @@ int get_port() } ``` +#### operator|= + +``` +template result& operator|=( result& r, U&& u ); +``` +[none] +* {blank} ++ +If `r` contains an error, assigns a value to it, constructed from `u`. ++ +Effects: :: + If `r.has_value()` is `false`, assigns `u` to `r`. +Returns: :: + `r`. +Remarks: :: + Only enabled when `U` is convertible to `T`. + +``` +template result& operator|=( result& r, F&& f ); +``` +[none] +* {blank} ++ +If `r` contains an error, assigns `f()` to it. ++ +Effects: :: + If `r.has_value()` is `false`, assigns `f()` to `r`. +Returns: :: + `r`. +Remarks: :: + Only enabled when the type of `f()` is either + - convertible to `T` or + - an instance of `result` convertible to `result`. + + #### operator& ```