Boost logo

Boost :

Subject: Re: [boost] [variant] match()
From: Eelis (eelis_at_[hidden])
Date: 2015-01-09 17:54:48


On 2015-01-09 19:35, Matt Calabrese wrote:
> You seem to be not getting that discriminated_union and variant each are
> used in different scenarios.

> One quick scenario for where you want a variant is:

Why do you want a variant here? Can't you define an apply() for discriminated_union that does exactly what you want? Why do you need a different type? More specifically, why do you need a type for which

   match(v,
     [](A a){...},
     [](B b){...}
   )

randomly breaks in generic code?


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