/* * * Copyright (c) 1994 * Hewlett-Packard Company * */ #ifndef UTILITIES_H #define UTILITIES_H #include "sequential_iterator.H" template inline T max(T a, T b) { return b > a ? b : a; } template inline T min(T a, T b) { return b < a ? b : a; } template inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; } template EuclideanRingElement gcd(EuclideanRingElement m, EuclideanRingElement n) { while (n != 0) { EuclideanRingElement t = m % n; m = n; n = t; } return m; } template inline Iterator2 moveBackward(Iterator1 first, Iterator1 last, Iterator2 result) { while (first != last) *--result = *--last; return result; } #endif