Below are the structures and a class i have designed and the ultimate goal is to write values to an xml using boost serialization When i compile the code below i get a compile time error (The error is huge and i just pasted the last line of it which perhaps talks about the issue)
/boost_1_49_0/include/boost/serialization/access.hpp:118: error: 'class std::map, std::allocator >, std::map, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > >, std::less, std::allocator > >, std::allocator, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > > > > >, std::less, std::allocator > >, std::allocator, std::allocator >, std::map, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > >, std::less, std::allocator > >, std::allocator, std::allocator >, std::map, std::allocator >, IdInfo, std::less, std::allocator > >, std::allocator, std::allocator >, IdInfo> > > > > > > > >' has no member named 'serialize' make: *** [READER.exe] Error 1
The AssetReaderInfo clkass below actually has a member serialize but the error contradicts it.
i have defined serialization in all the classes but its failing to compile Also, I havent specfied the main cpp code as i thought it adds to confusion
Would you please suggest what went wrong ?
struct IdInfo
{
std::string m_milePost;
std::string m_cellModemAlertExclusionList;
public:
IdInfo():m_milePost("milepost"),m_cellModemAlertExclusionList("dummyval"){};
template<class archive>
void serialize(archive& ar, const unsigned int version)
{
using boost::serialization::make_nvp;
ar & make_nvp("values", m_milePost);
ar & make_nvp("values", m_cellModemAlertExclusionList);
}
};
class myReader {
public:
friend class boost::serialization::access;
// Asset ID list
typedef std::map< std::string,IdInfo > myMap;
typedef std::map< std::string > mySet;
struct ReaderInfo
{
mySet m_aSList;
myMap m_pList;
myMap m_eList;
// WIU/BS type
std::string m_Type;
std::string m_topic;
std::string m_lastSavedMsg;
template <class archive>
void serialize(archive& ar, const unsigned int version)
{
using boost::serialization::make_nvp;
ar & make_nvp("values", m_topic);
ar & make_nvp("values", m_Type);
ar & make_nvp("values", m_eList);
ar & make_nvp("values", m_pList);
}
};
typedef std::map< std::string, ReaderInfo > GroupDataMap;
GroupDataMap m_GroupDataMap;
template<class archive>
void serialize(archive& ar, const unsigned int version)
{
using boost::serialization::make_nvp;
ar & make_nvp("Group", m_GroupDataMap);
}
}
int main()
{
myReader Reader;
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("Connections", Reader);
}
Solution:
It turns out that i should include /boost/serialization/map.hpp as iam using a std::map
Thanks for the Help
It turns out that i should include /boost/serialization/map
.hpp as iam using a std::map
#include /boost/serialization/map.hpp