boost::uuids::uuid with SF
Posted: Tue Apr 23, 2013 12:25 pm
(RCF 2.0.0.2679, selected serialization formats : SF and boost::serialization, gcc 4.6)
Hi Jarl,
I tried to serialize the boost class boost::uuids::uuid . First I thought its pretty simple, because it boils down to serialize an array of boost::uint8_t :
I tried the following code :
SF doesn't seem to handle an array of boost::uint8_t as fundamental and tries to call method u.data.serialize( SF::Archive &ar ), which of course fails. I tried to work around this but didn't find a satisfying solution...
(IMHO the best way to solve this would be to change the definition in boost::uuids::uuid as the author of this module already suggested but this would last far too long ...)
Regards,
Volker
Hi Jarl,
I tried to serialize the boost class boost::uuids::uuid . First I thought its pretty simple, because it boils down to serialize an array of boost::uint8_t :
Code: Select all
namespace boost {
namespace uuids {
struct uuid
{
// or should it be array<uint8_t, 16>
uint8_t data[16];
};
}
}
Code: Select all
#include <boost/uuid/uuid.hpp>
#include <SF/Archive.hpp>
namespace SF
{
void serialize( SF:Archive &ar, boost::uuids::uuid &u )
{
ar & u.data ;
}
}
(IMHO the best way to solve this would be to change the definition in boost::uuids::uuid as the author of this module already suggested but this would last far too long ...)
Regards,
Volker