
22 Apr
2006
22 Apr
'06
9:56 a.m.
Alberto Ganesh Barbati wrote:
template <typename T> struct compare_absolute_error : std::binary_function<T, T, bool>
bool operator()(T x, T y) const { return abs(x - y) < eps; } 1) Is there interest for this?
I'm not math expert, but I certainly agree that such utility would be useful. However, as some standard algorithms need equality comparison, while containers need less-than comparison, it would be nice to provide at least then both, and make names obvious enough.
2) What are the comparison algorithms to include?
good question. But if comparision algorithm is a template parameter (policy class), we do not have to define them all in advance. B.