Note that there are some explanatory texts on larger screens.

plurals
  1. POboost serialization of opaque types
    primarykey
    data
    text
    <p>I want to be able to serialize a Windows HANDLE:</p> <pre><code>typedef void *HANDLE </code></pre> <p>If I try to compile using following:</p> <pre><code>struct Foo { HANDLE file; protected: friend class boost::serialization::access; template&lt;class Archive&gt; void serialize(Archive &amp; ar, const unsigned int /*version*/) { ar &amp; file; } }; </code></pre> <p>I get compile errors:</p> <pre><code>c:\projects\3rdparty\src\boost\include\boost/mpl/print.hpp(51) : warning C4308: negative integral constant converted to unsigned type c:\projects\3rdparty\src\boost\include\boost/serialization/static_warning.hpp(92) : see reference to class template instantiation 'boost::mpl::print&lt;T&gt;' being compiled with [ T=boost::serialization::BOOST_SERIALIZATION_STATIC_WARNING_LINE&lt;98&gt; ] c:\projects\3rdparty\src\boost\include\boost/archive/detail/check.hpp(98) : see reference to class template instantiation 'boost::serialization::static_warning_test&lt;B,L&gt;' being compiled with [ B=false, L=98 ] c:\projects\3rdparty\src\boost\include\boost/archive/detail/oserializer.hpp(313) : see reference to function template instantiation 'void boost::archive::detail::check_object_tracking&lt;T&gt;(void)' being compiled with [ T=Foo ] c:\projects\3rdparty\src\boost\include\boost/archive/detail/oserializer.hpp(525) : see reference to function template instantiation 'void boost::archive::detail::save_non_pointer_type&lt;Archive&gt;::invoke&lt;T&gt;(Archive &amp;,T &amp;)' being compiled with [ Archive=boost::archive::text_oarchive, T=Foo ] </code></pre> <p>But if I change <code>file</code> to an <code>int</code>, everything is fine. How do I tell boost to serialize HANDLEs as ints?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload