@@ -32,7 +32,12 @@ namespace capy {
3232 if (ec) { ... }
3333 @endcode
3434
35- @tparam Args Additional value types beyond the error code.
35+ @note Only 0, 1, 2, and 3 payload specializations are
36+ provided. Payload members are only meaningful when
37+ `ec` does not indicate an error.
38+
39+ @tparam Args Ordered payload types following the leading
40+ `std::error_code`.
3641*/
3742template <class ... Args>
3843struct io_result
@@ -100,7 +105,7 @@ struct [[nodiscard]] io_result<T1>
100105 // / The error code from the operation.
101106 std::error_code ec;
102107
103- // / The first result value.
108+ // / The first payload value. Unspecified when `ec` is set .
104109 T1 t1{};
105110
106111#ifdef _MSC_VER
@@ -132,6 +137,19 @@ struct [[nodiscard]] io_result<T1>
132137
133138/* * Result type for operations returning two values.
134139
140+ Stores a leading `std::error_code` followed by two
141+ operation-specific payload values. Inspect `t1` and `t2`
142+ only when `ec` does not indicate an error.
143+
144+ @par Example
145+ @code
146+ auto [ec, t1, t2] = co_await some_op();
147+ if (ec) { ... }
148+ @endcode
149+
150+ @tparam T1 First payload type following the error code.
151+ @tparam T2 Second payload type following T1.
152+
135153 @see io_result
136154*/
137155template <typename T1, typename T2>
@@ -140,10 +158,10 @@ struct [[nodiscard]] io_result<T1, T2>
140158 // / The error code from the operation.
141159 std::error_code ec;
142160
143- // / The first result value.
161+ // / The first payload value. Unspecified when `ec` is set .
144162 T1 t1{};
145163
146- // / The second result value.
164+ // / The second payload value. Unspecified when `ec` is set .
147165 T2 t2{};
148166
149167#ifdef _MSC_VER
@@ -178,6 +196,20 @@ struct [[nodiscard]] io_result<T1, T2>
178196
179197/* * Result type for operations returning three values.
180198
199+ Stores a leading `std::error_code` followed by three
200+ operation-specific payload values. Inspect `t1`, `t2`,
201+ and `t3` only when `ec` does not indicate an error.
202+
203+ @par Example
204+ @code
205+ auto [ec, t1, t2, t3] = co_await some_op();
206+ if (ec) { ... }
207+ @endcode
208+
209+ @tparam T1 First payload type following the error code.
210+ @tparam T2 Second payload type following T1.
211+ @tparam T3 Third payload type following T2.
212+
181213 @see io_result
182214*/
183215template <typename T1, typename T2, typename T3>
@@ -186,13 +218,13 @@ struct [[nodiscard]] io_result<T1, T2, T3>
186218 // / The error code from the operation.
187219 std::error_code ec;
188220
189- // / The first result value.
221+ // / The first payload value. Unspecified when `ec` is set .
190222 T1 t1{};
191223
192- // / The second result value.
224+ // / The second payload value. Unspecified when `ec` is set .
193225 T2 t2{};
194226
195- // / The third result value.
227+ // / The third payload value. Unspecified when `ec` is set .
196228 T3 t3{};
197229
198230#ifdef _MSC_VER
@@ -230,8 +262,8 @@ struct [[nodiscard]] io_result<T1, T2, T3>
230262
231263#ifdef _MSC_VER
232264
233- // / @name Free-standing get() overloads for ADL (MSVC aggregate workaround).
234- // / @{
265+ // Free-standing get() overloads for ADL (MSVC aggregate workaround).
266+ // / @cond
235267
236268template <std::size_t I>
237269auto & get (io_result<>& r) noexcept
@@ -305,7 +337,7 @@ auto&& get(io_result<T1, T2, T3>&& r) noexcept
305337 return std::move (r).template get <I>();
306338}
307339
308- // / @}
340+ // / @endcond
309341
310342#endif // _MSC_VER
311343
0 commit comments