Boost logo

Boost Users :

Subject: Re: [Boost-users] [Optional] Lazy initialized optional
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2018-11-14 23:29:21


On Wed, Nov 14, 2018 at 5:27 PM Gavin Lambert via Boost-users
<boost-users_at_[hidden]> wrote:
>
> On 14/11/2018 23:03, Martijn Otto wrote:
> > If you do it in a separate class instead, you can clear the callback
> > after invoking it. Then checking whether a callback exists will tell
> > you whether the object was initialized.
>
> Unless the callback itself can produce an optional value.

It was simple enough. Instead of an "is an optional" use case it was
more of a "has an optional" use case, with the optional being a
one-time, factory initialized value. Worked pretty well. :+1: I even
managed to leverage the optional operator->() overload in order to
access the thing inside the optional post-initialization.

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net