Boost logo

Boost :

Subject: Re: [boost] [Optional] Monadic bind
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2015-06-22 10:22:59


2015-06-22 15:49 GMT+02:00 Tobias Loew <Tobias.Loew_at_[hidden]>:

> While playing around with boost::optionals I had code like the following
>
> struct A {
> ...
> int i;
> ...
> };
>
> boost::optional a;
> // do something with 'a'
>
> // optional-projection to a::i
> boost::optional<int> a_i;
> if(a)
> a_i = a->i;
>
>
Could you give us an example here that would compile?

boost::optional a;
The above is not a valid variable declaration (template argument missing),
so it is difficult for me to gather what you are trying to do.

Regards,
&rzej


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