If this interests anyone - I figured it out. Basically the ordering of the headers included matters:
Before
#include
You must add
#include
#include
Then it'll work - even if you don't use the archivers until another unit.
Jim
----- Original Message -----
From: "james vanns"
To: boost-users@lists.boost.org
Sent: Friday, 30 May, 2008 11:03:38 AM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Compile error when serializing an std::map./
Hi all, with Boost 1.3.5 and g++ 4.2.1 on Linux I get the following compile error from one of the Boost headers:
boost/serialization/utility.hpp:48: error: expected template-name before ‘<’ token
boost/serialization/utility.hpp:48: error: expected `{' before ‘<’ token
boost/serialization/utility.hpp:48: error: expected unqualified-id before ‘<’ token
boost/serialization/utility.hpp:50: error: extra ‘;’
I am trying to serialize a map like so:
#include
using std::map;
struct Resource {
enum ID {
CPU = 0,
RAM,
TMP,
PRMAN
};
static const char* const name[];
};
class ResourceSet {
private:
typedef uint16_t Tally;
typedef Resource::ID RID;
map m_resources;
private:
friend class boost::serialization::access;
template<class Archive>
void serialize (Archive &p_ark, const unsigned int p_version);
};
template<class Archive>
void
ResourceSet::serialize (Archive &p_ark, const unsigned int p_version)
{
p_ark & m_resources;
}
So I am wondering why the compiler is spitting out this error? Is this a bug or is this because of the typedefs? Line 48+ from utility.hpp is this:
/// specialization of is_bitwise_serializable for pairs
template
struct is_bitwise_serializable >
: public mpl::and_
{
};
} // serialization
} // namespace boost
Regards,
Jim Vanns
--
James Vanns
Systems Programmer
Framestore CFC Ltd.
--
James Vanns
Systems Programmer
Framestore CFC Ltd.