Boost logo

Boost Users :

Subject: Re: [Boost-users] Using Coroutines in the Visitor Pattern (use-case: BGL event visitor)
From: Nat Goodspeed (nat_at_[hidden])
Date: 2016-01-20 09:36:27


On Wed, Jan 20, 2016 at 4:35 AM, alex <alexhighviz_at_[hidden]> wrote:

>>I expect the following in the evaluation of the while condition
>>
>>1.The operator () will enter somefunc().

> It is dawning on me now. At the first invocation operator() should enter
> somefunc(), whereas at all subsequent invocations it has to re-enter
> somefunc(). I suppose enter and re-enter are different operations, hence the
> first invocation would be a special case.

To be honest, I suppose your proposed API would be a viable
alternative. I think part of the rationale for the current API design
was to permit facile mapping to iterator operations:

iterator comparison to end => operator bool()
iterator operator*() => get()
iterator operator++() => operator()()

Perhaps, having become accustomed to the present API, I'm simply
rationalizing its design. I'm sorry if I caused offense.


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