Regarding your other question, I'm not totally sure I understand,
could you post a short code snippet?
class Serialization {
Zachary Turner wrote:
private:
struct DataStructure {
std::map m_Uint16Map;
std::map m_Uint32Map;
void remove (std::string const& variableName) {
m_Uint16Map.erase(variableName);
m_Uint32Map.erase(variableName);
}
};
typedef boost::shared_ptr<DataStructure> boostData;
std::map m_DataMap;
boostData
m_CurrentStructure;
public:
Serialization(void) {
m_CurrentStructure = boostData(new DataStructure);
m_DataMap[""] = m_CurrentStructure;
}
void putUint16(std::string const& variableName, uint16 variable) {
m_CurrentStructure.remove(variableName);
m_CurrentStructure->m_Uint16Map[variableName] = variable;
}
void putUint32(std::string const& variableName, uint32 variable) {
m_CurrentStructure.remove(variableName);
m_CurrentStructure->m_Uint32Map[variableName] = variable;
}
};
You can do them in the form of template specializations for the type
of data to store/retrieve
If I use template specialization I would be creating a function for
every type. This doesn't seem any better than creating a function for
each type I want. Why would I want to do this?
Ryan