
1 Jun
2009
1 Jun
'09
11:41 p.m.
I have a couple of functions that provide the same functionality for different types. I'd like to combine them to reduce code duplication. An example of two functions is listed below. std::map<std::string, uint16> m_Uint16; std::map<std::string, uint32> m_Uint32; void putUint16(std::string const& variableName, uint16 const& value) { m_Uint16[variableName] = value; } void putUint32(std::string const& variableName, uint32 const& value) { m_Uint32[variableName] = value; } The functions can't be combined into a template since they are the interface for the programmer. Is there a boost library that would let me call a template or common function that would use a different variable based on the variable type? Ryan