I have a pair of overloaded functions:
void func(const std::string& str, int a, char ch, double d) { // piece of code A sendMsg(str, a, ch, d); // piece of code B } void func(int a, char ch, double d) { // piece of code A sendMsg(a, ch, d); // piece of code B } piece of code A and piece of code B are exactly the same, the only difference is the parameter of sendMsg.
Is there some way to avoid the code duplication?
sendMsgis a library function, which does some socket job. I can't change it anyway.not suitable for my caseis best prove of that.