Hi,<br><br>In the following code I show how a boost::variant that has a boost::blank cannot be serialized, and a proposed fix. I argue that this should work out of the box. This is with Boost 1.42.0.<br><br>Am I doing something wrong here, or is serialization of boost::blank somewhere already?<br>
<br>Thanks<br><br>#include &lt;boost/variant/variant.hpp&gt;<br>#include &lt;boost/serialization/variant.hpp&gt;<br>#include &lt;boost/archive/text_oarchive.hpp&gt;<br>#include &lt;sstream&gt;<br><br>#ifdef FIX<br>// suggested fix: non-intrusive serialize() for boost::blank<br>
namespace boost { namespace serialization<br>{<br>    template&lt;class Archive&gt;<br>    void serialize(Archive &amp;, boost::blank &amp;, const unsigned int)<br>    {<br>        // Nothing to do here<br>    }<br>} }<br>
#endif<br><br>int main()<br>{<br>    boost::variant&lt;int, double&gt; v1 = 666;<br>    boost::variant&lt;boost::blank, int, double&gt; v2 = 666;<br><br>    std::ostringstream os;<br>    boost::archive::text_oarchive oa(os);<br>
    <br>    // works!<br>    oa &lt;&lt; v1;<br>    <br>    // compile error about boost::blank not having a serialize method<br>    // #define FIX to compile<br>    oa &lt;&lt; v2;<br><br>    return 0;<br>}<br><br>

