C++ Logo


Advanced search

Subject: Re: std::variant - going from Alternative& to the enclosing variant&
From: Roman Odaisky (roma_at_[hidden])
Date: 2020-08-22 19:17:54

On Friday, 21 August 2020 17:06:47 EEST Victor Khomenko via Std-Discussion

> Problem: How to change the value of a variant from within a visitor?

Sorry if I’m missing something, but can’t you simply pass the variant as
another parameter with something like this?

std::visit([&](auto&& value) {
    my_visitor(value, the_variant);
}, the_variant);


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

Older Archives on Google Groups