Boost logo

Boost :

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


2015-06-22 16:22 GMT+02:00 Andrzej Krzemienski <akrzemi1_at_[hidden]>:

>
>
> 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?
>

Ok, you meant boost::optional<A> a;

Now I see what you are talking about.

Regards,
&rzej


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