P
Philipp
Hello I have a function writeValueXml(,,int) (see below) which converts
an int value to a string which is then passed to a overloaded version of
itself for printing writeValueXml(,,string)
This works for int. Is there a way to write one unique such a function
for all integer types? (signed/unsigned short/int/long) without
rewriting the code?
Maybe using the automatic promotion from one type to another? (what's
the promotion between signed and unsigned?)
Or with a template? (how to specify only int types are allowed?)
Thanks for answers
Phil
--- code ---
void Parameters::writeValueXml(TiXmlElement* atomElem, string
xmlElemName, int value){
std::stringstream converter;
converter << value;
string v = converter.str();
writeValueXml(atomElem, xmlElemName, v);
}
an int value to a string which is then passed to a overloaded version of
itself for printing writeValueXml(,,string)
This works for int. Is there a way to write one unique such a function
for all integer types? (signed/unsigned short/int/long) without
rewriting the code?
Maybe using the automatic promotion from one type to another? (what's
the promotion between signed and unsigned?)
Or with a template? (how to specify only int types are allowed?)
Thanks for answers
Phil
--- code ---
void Parameters::writeValueXml(TiXmlElement* atomElem, string
xmlElemName, int value){
std::stringstream converter;
converter << value;
string v = converter.str();
writeValueXml(atomElem, xmlElemName, v);
}