Reference: |
CplusplusExternal LinksThe 50 rules from Scott Meyers for effective programming in C++:
A chapter that is often under estimated: templates in c++ template <class T> bool reange( T value, T min, T max) {
return value >= min && value <= max;
}
that is for the compiler. It save these structure for later use.
bool result = range(5,1,10); the compiler generates automatically a function with the template above.
bool range( int value, int min, int max) {
return value >=min && value <= max;
}
|