// VARIOUS TEMPLATES #ifndef _TEMPLATE_H #define _TEMPLATE_H // ABS template inline type abs(type nr) { return (nr>=0)?nr:-nr; } // SWAP template inline void swap(type& nr1,type& nr2) { type temp=nr1; nr1=nr2; nr2=temp; } // MAX template inline type max(type nr1,type nr2) { return nr1>nr2?nr1:nr2; } // MIN template inline type min(type nr1,type nr2) { return nr1 inline void sort(type& nr1,type& nr2) { if (nr1>nr2) swap(nr1,nr2); } // FIT template void fit(type nr1,type& nr2,type nr3) { nr2=max(nr1,nr2); nr2=min(nr2,nr3); } #endif