diff --git a/doc/system/changes.adoc b/doc/system/changes.adoc index dce808c..dd28182 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 9327d0e..5d62df4 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& ```