Boost C++ Libraries: Ticket #9502: Unexpected behaviour of boost::mpi::request::test() https://svn.boost.org/trac10/ticket/9502 <p> The following code snippet shows that boost::mpi::request::test() behaves differently depending on whether we send a message of built-in type or a message of custom type: </p> <pre class="wiki">struct custom_type { template&lt;class Archive&gt; void serialize(Archive&amp; ar, const unsigned int version) {} }; [...] int i; auto req = comm.irecv(0,0,i); req.wait(); std::cout &lt;&lt; "Did we receive the built in type message: " &lt;&lt; bool(req.test()) &lt;&lt; std::endl; custom_type c; auto req = comm.irecv(0,0,c); req.wait(); std::cout &lt;&lt; "Did we receive the custom type message: " &lt;&lt; bool(req.test()) &lt;&lt; std::endl; </pre><p> Output: </p> <pre class="wiki">Did we receive the built in type message: 1 Did we receive the custom type message: 0 </pre><p> Similar behaviour is observed if you just repeatedly call req.test(): For the built-in type, the returned boost::optional switches from empty to non-empty once and then stays non-empty, whereas for the custom type it switches from empty to non-empty and in the next call goes back to empty again. </p> <p> For our application, it would be desirable if the custom type behaviour would be the same as the built-in type behaviour. If this is not possible or not advisable, then at least the documentation of boost::mpi::request should mention this difference in behaviour. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9502 Trac 1.4.3 ettersi@… Tue, 17 Dec 2013 14:06:15 GMT attachment set https://svn.boost.org/trac10/ticket/9502 https://svn.boost.org/trac10/ticket/9502 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">request.cpp</span> </li> </ul> <p> Complete program that reproduces the error </p> Ticket