Date: Mon, 6 Jul 2026 15:33:58 +0200
On 7/5/26 23:45, Vitaly Fanaskov via Std-Proposals wrote:
> This paper aims to extend monadic operations of std::expected and
> std::optional by allowing taking extra arguments. These arguments will
> be forwarded to the given function, passed after the first argument with
> the contained value. When applicable, the position of the contained
> value can be controlled using a placeholder mechanism.
The new placeholder type is unnecessary as
const auto result = createComponent(ctx, path, metaData)
.and_then(&Database::store, db, std::placeholders::value);
is essentially
const auto result = createComponent(ctx, path, metadata)
.and_then(std::bind(&Database::store, &db, std::placeholders::_1));
> This paper aims to extend monadic operations of std::expected and
> std::optional by allowing taking extra arguments. These arguments will
> be forwarded to the given function, passed after the first argument with
> the contained value. When applicable, the position of the contained
> value can be controlled using a placeholder mechanism.
The new placeholder type is unnecessary as
const auto result = createComponent(ctx, path, metaData)
.and_then(&Database::store, db, std::placeholders::value);
is essentially
const auto result = createComponent(ctx, path, metadata)
.and_then(std::bind(&Database::store, &db, std::placeholders::_1));
Received on 2026-07-06 13:34:04
