4votes
How to combine multiple functions into a single template based function
It is impossible for us to tell if there is a better way for merging such two similar but not identical functions without knowing the details of the actual functions and how the differences cam about. ...
2votes
How to combine multiple functions into a single template based function
In my experience, the easiest way to have a template that does specific things for one particular type is overloading. void PrintDebugInfo(std::list<int>& obj1, std::list<int>& ...
1vote
How to combine multiple functions into a single template based function
Sure, combine to reuse by splitting them: result = FindMaxDistanceList(obj1, obj2); if (_DEBUG_ENABLED_) PrintDebugInfo(obj1, ob2); This way, each call site gets to decide what to print, and ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
c++ × 2787c × 290
design × 264
object-oriented × 240
design-patterns × 198
java × 153
c++11 × 133
object-oriented-design × 102
coding-style × 100
c# × 96
data-structures × 81
multithreading × 76
programming-practices × 73
algorithms × 71
performance × 71
programming-languages × 69
qt × 66
inheritance × 62
compiler × 61
architecture × 60
unit-testing × 60
libraries × 57
interfaces × 56
python × 55
memory × 55