Boost logo

Boost Users :

Subject: [Boost-users] [serialization] transparently treating a class like a built-in type
From: Kenneth Riddile (kfriddile_at_[hidden])
Date: 2010-07-26 20:51:22

I have some xml archives that store a lot of floating point values. I
would like to read these into a program that is designed to easily
switch between using floats and a custom fixed-point type via a typedef.
  The way that would be easiest would be to add a serialize() method to
the fixed-point class definition. However, the xml archive requires
that I use an nvp wrapper. Since the data was originally serialized out
as plain floats, the data looks something like this:


whereas, to serialize this into my fixed-point type, it would need
another level of indirection due to the additional required nvp wrapper
like so:


Is there a way to accomplish what I'm trying to do? The fixed-point
type is convertible from (but not to) a float if that helps.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at