C++ Logo


Advanced search

Subject: Re: std::variant - going from Alternative& to the enclosing variant&
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-08-21 09:12:12

On Fri, 21 Aug 2020 at 17:07, Victor Khomenko via Std-Discussion
<std-discussion_at_[hidden]> wrote:
> Dear all,
> [I searched the list's archive but didn't find anything relevant.]
> Problem: How to change the value of a variant from within a visitor? Unfortunately, there is no straightforward way to do that, as the relevant operator()(Alternative&) of the visitor has no access to the enclosing std::variant.

Use a lambda as a visitor and capture the variant in the lambda?

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups