## 22.6 Setting Behavior Using Template Arguments

- Specify behavior (set policy)
- Generalize the `max` function to support types that:
  - Don't define `operator<`
  - Have more than one way of ordering
- Make comparison a template argument:

  >     template<typename T, typename CMP>
  >     T max(const T& left, const T& right, CMP cmp)
  >     {
  >        if (cmp(left, right))
  >           return right;
  >        return left;
  >     }

prev |top |next