Well, my problem is to properly pass boost::coroutines::coroutine<std::string(void)>
object as function argument. I can't do that by reference because calling this method is realized by boost::bind
and boost::asio
(there is a possibility that this memory address will be invalid). So, is there any easy way to do that? Or the only way which left me is to pack this object into pointer?
Asked
Active
Viewed 420 times
0

Piwosz
- 21
- 3
-
please add some code to your question – Sam Miller Nov 18 '13 at 18:15
1 Answers
0
you could let a shared_ptr manage the coroutine and pass a weak_ptr to bind(). In the callback-function you could check via weak_ptr if the shared_ptr is still valid:
shared_ptr< coroutine<...> > sp = wp.lock();
if (sp) {
...
} else {
// shared_ptr was released
}

olk
- 372
- 1
- 3