<div dir="ltr">Yes, I know this is a different approach but I wanted to maintain a pure object model. I don&#39;t know if this is a good approach or not, but then again, I&#39;m implementing a prototype.<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span style="font-family:arial,sans-serif;font-size:11px">1.) do you know that boost.asio integrates boost.coroutine? example can be read at </span><a href="http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp" target="_blank" style="font-family:arial,sans-serif;font-size:11px">http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp</a></blockquote>

<div>Yes, I noticed that but I kinda got lost when I saw that spawn(...) used stackfull coroutines but at the boost::asio::coroutine documentation, stackless coroutines were described. I wanted to ensure I was using stackfull coroutines.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="font-family:arial,sans-serif;font-size:11px">2.) coroutine&lt;&gt; is a type holder, e.g. you have to derive from coroutine&lt;&gt;::push_type or coroutine&lt;&gt;::pull_type</span></blockquote>

<div>I also saw that documentation and also got lost there... What is the difference between the push_type and pull_type? For what purposes should I use them?</div><div><br></div><div><div dir="ltr" style="font-family:arial,sans-serif;font-size:11px">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">3.) usually you would not track SimpleObj as is-a-coroutine -&gt; I suggest to aggregate coroutine&lt;&gt; instead derive from it</blockquote>

<div><br></div></div></div><div>I also though about that... I just didn&#39;t know what was the best approach. Thinking a second time pushes me to go with the approach you just described.</div><div><br></div><div>Thanks for the info.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 19 December 2013 14:06, Oliver Kowalke <span dir="ltr">&lt;<a href="mailto:oliver.kowalke@gmail.com" target="_blank">oliver.kowalke@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im"><div class="gmail_extra"><div class="gmail_quote">2013/12/19 Carlos Ferreira <span dir="ltr">&lt;<a href="mailto:carlosmf.pt@gmail.com" target="_blank">carlosmf.pt@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hello to all.<br><br>I need some help using the Boost.Coroutine lib.<br>I wanted to use the coroutines as objects and for that, I tried to build a simple object and inherit the boost::coroutines::coroutine template.<br>




<br>ex:<br><br><div><span style="white-space:pre-wrap">	</span>class SimpleObj : public boost::coroutines::coroutine&lt;SimpleObj&gt;{</div><div><span style="white-space:pre-wrap">		</span>private:</div><div><span style="white-space:pre-wrap">			</span>std::unique_ptr&lt;boost::asio::ip::tcp::socket&gt; tcpSkt_uPtr;</div>




<div><span style="white-space:pre-wrap">			</span>std::unique_ptr&lt;boost::asio::ip::tcp::acceptor&gt; acc_uPtr;</div><div><br></div><div><span style="white-space:pre-wrap">		</span>public:</div><div><span style="white-space:pre-wrap">			</span>SimpleObj(std::shared_ptr&lt;boost::asio::io_service&gt; ioService_ptr, boost::asio::ip::tcp::endpoint &amp;endPoint);</div>




<div><span style="white-space:pre-wrap">			</span>~SimpleObj();</div><div><span style="white-space:pre-wrap">			</span>void run();</div><div><span style="white-space:pre-wrap">	</span>};</div><br><br clear="all">

<div>Is this right? Can I actually inherit from the boost::coroutines::coroutine template ?<br>If yes, how can I proceed from here, to use the run() object method as the coroutine itself, with an io_service  provided  through the constructor ?<br>


</div></div></blockquote></div><br></div></div><div class="gmail_extra">1.) do you know that boost.asio integrates boost.coroutine? example can be read at <a href="http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp" target="_blank">http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/example/cpp03/spawn/echo_server.cpp</a><br>


</div><div class="gmail_extra">2.) coroutine&lt;&gt; is a type holder, e.g. you have to derive from coroutine&lt;&gt;::push_type or coroutine&lt;&gt;::pull_type<br></div><div class="gmail_extra">3.) usually you would not track SimpleObj as is-a-coroutine -&gt; I suggest to aggregate coroutine&lt;&gt; instead derive from it<br>


</div></div>
<br>_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
<a href="http://listarchives.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://listarchives.boost.org/mailman/listinfo.cgi/boost-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">

<div><br></div><div>Carlos Miguel Ferreira</div><div>Researcher at Telecommunications Institute</div><div>Aveiro - Portugal</div><div>Work E-mail - <a href="mailto:cmf@av.it.pt" target="_blank">cmf@av.it.pt</a></div><div>

Skype &amp; GTalk -&gt; <a href="http://carlosmf.pt" target="_blank">carlosmf.pt</a>@<a href="http://gmail.com" target="_blank">gmail.com</a></div><div>LinkedIn -&gt; <a href="http://www.linkedin.com/in/carlosmferreira" target="_blank">http://www.linkedin.com/in/carlosmferreira</a></div>

</div>
</div>

