|
Boost Users : |
From: Diane (dbutton_at_[hidden])
Date: 2008-08-28 22:47:16
Based on tutorial and reference material, and some previous posts here, it seems
like I should be able to serialize a char* by using a wrapper like tracked_char:
BOOST_STRONG_TYPEDEF(char, tracked_char)
template<class Archive>
void serialize(Archive &ar, tracked_char & tc){
ar & tc;
}
But when I try to serialize my struct that contains char*:
typedef struct MYSTRUCT
{
char chtest;
char *chstar;
} MYSTRUCT;
template<class Archive>
void serialize(Archive & ar, MYSTRUCT & it, const unsigned int version)
{
ar & it.chtest;
tracked_char *tcp = it.chstar; //****error on this line****//
ar & *tcp;
}
I get this compile error: cannot convert `char*' to `tracked_char*' in
initialization
What is the compiler complaining about here? How do I fix it? I'm not sure if I
have the correct usage of BOOST_STRONG_TYPEDEF, so I also tried:
struct tracked_char {
char m_char; // the real data
template<class Archive>
void serialize(Archive &ar, unsigned int version){
ar & m_char;
}
// casting operators - not compiled
char operator char () const { //****error here****//
return m_char;
}
char & operator char() { //****error here****//
return m_char;
}
};
I need someone to point me in the right direction.
Thanks,
Diane
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net