U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » Defs.h minmax() change/fix
Defs.h minmax() change/fix [message #24061] Wed, 23 December 2009 19:31 Go to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi there

in Defs.h:214

why not using

template <class T>
inline const T& minmax(const T& x, const T& _min, const T& _max) { return min(max(x, _min), _max); }


instead of

template <class T>
inline T minmax(T x, T _min, T _max) { return min(max(x, _min), _max); }


which is sort of logically semantics
especially when you consider the other related templates:

template <class T> inline const T& min(const T& a, const T& b) { return a < b ? a : b; }
template <class T> inline const T& max(const T& a, const T& b) { return a > b ? a : b; }

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Uuid formating with dashes
Next Topic: ERROR: EXCEPTION_ACCESS_VIOLATION IN CORE ON DEBUGGING!
Goto Forum:
  


Current Time: Wed May 27 00:07:40 GMT+2 2026

Total time taken to generate the page: 0.00547 seconds