Boost logo

Boost :

Subject: Re: [boost] [variant] address of a variant type from the address of itssub-object?
From: Peter Dimov (lists_at_[hidden])
Date: 2016-04-14 07:06:48


Andrzej Krzemienski wrote:
> The problem I am solving is to how to access the whole variant object from
> inside a static visitor:
>
> ```
> using VariantOb = boost::variant<Ob>;
>
> struct MyVisitor : boost::static_visitor<>
> {
> void operator()(Ob const& ob) const

Can't you have

struct MyVisitor
{
    typedef void result_type;
    void operator()(Ob const& ob, Var const& var) const;
};

and then pass bind( MyVisitor(), _1, ref(v) ) to visit?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk