new functions min and max for 2 - 6 parameters

master
Marc Wäckerlin 9 years ago
parent 065941d8d7
commit 3a8795996f
  1. 72
      src/mrw/mrw.hxx.in
  2. 94
      src/mrw/stdext.hxx

@ -1,16 +1,8 @@
/** @mainpage
The official homepage is on:
- http://marc.waeckerlin.org/computer/c_/mrw-c_/index
- https://dev.marc.waeckerlin.org/redmine/projects/mrw-cxx
The minimal runtime package (for use with VideoreKorder):
Minimalpaket (für den VideoreKorder):
- <a href="/downloads/@PACKAGE_NAME@-minimal-@PACKAGE_VERSION@-1.i586.rpm">@PACKAGE_NAME@-minimal-@PACKAGE_VERSION@-1.i586.rpm</a>
More downloads see @ref downloads.
All features are listed on the <a
href="modules.html">"Modules"</a> page.
@ -43,68 +35,6 @@
and I'll try to help you! My email address is in the file AUTHORS
and on my website: http://marc.waeckerlin.org
@section moreinfo Additional Information
See the <a href="pages.html">"Related Pages"</a>.
- @ref downloads
- @ref readme
- @ref usage
- @ref threads
- @ref libversion
- @ref license
- @ref install
- @ref news
- @ref changes
*/
/** @page downloads Download and Installation of the MRW-C++ Library
Download this documentation in PDF:
- <a href="/downloads/@PACKAGE_NAME@-@PACKAGE_VERSION@.pdf">@PACKAGE_NAME@-@PACKAGE_VERSION@.pdf</a>
Download this version from here:
- Source
- Source TAR-Ball:
- <a href="/downloads/@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz">@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz</a>
- Installation:
-# <code>tar xzf @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz</code>
-# <code>cd @PACKAGE_NAME@-@PACKAGE_VERSION@</code>
-# <code>./configure && make all install</code>
- Source RPM Packages:
- <a href="/downloads/@PACKAGE_NAME@-@PACKAGE_VERSION@-1.src.rpm">@PACKAGE_NAME@-@PACKAGE_VERSION@-1.src.rpm</a>
- Installation:@n <code>sudo rpmbuild --rebuild @PACKAGE_NAME@-@PACKAGE_VERSION@-1.src.rpm</code>
- Requirements to build from source:
- boost: http://boost.org
- cppunit: http://cppunit.sf.net
- log4cxx: http://logging.apache.org/log4cxx
- doxygen: http://doxygen.org
- graphviz: http://www.research.att.com/sw/tools/graphviz
- GNU binutils (you also need the development package, if it is separete (e.g. in Debian))
- GNU g++, GNU make, GNU autotools: http://gnu.org
- Binary
- Binary RPM Packages (built on i586/SuSE):
- <a href="/downloads/@PACKAGE_NAME@-minimal-@PACKAGE_VERSION@-1.i586.rpm">@PACKAGE_NAME@-minimal-@PACKAGE_VERSION@-1.i586.rpm</a>
- Minimal runtime package without debugging support.@n Does not depend on boost and log4cxx and ltdl.@n To be used e.g. with [[:Computer:Linux:Programme:Videorekorder]]
- Installation:@n <code>rpm -Uvh @PACKAGE_NAME@-minimal-@PACKAGE_VERSION@-1.i586.rpm</code>
- <a href="/downloads/@PACKAGE_NAME@-@PACKAGE_VERSION@-1.i586.rpm">@PACKAGE_NAME@-@PACKAGE_VERSION@-1.i586.rpm</a>
- Full runtime library, no multithreading.
- Installation:@n <code>rpm -Uvh @PACKAGE_NAME@-@PACKAGE_VERSION@-1.i586.rpm</code>
- <a href="/downloads/@PACKAGE_NAME@-mt-@PACKAGE_VERSION@-1.i586.rpm">@PACKAGE_NAME@-mt-@PACKAGE_VERSION@-1.i586.rpm</a>
- Full runtime library, with multithreading support.
- Installation:@n <code>rpm -Uvh @PACKAGE_NAME@-mt-@PACKAGE_VERSION@-1.i586.rpm</code>
- <a href="/downloads/@PACKAGE_NAME@-devel-@PACKAGE_VERSION@-1.i586.rpm">@PACKAGE_NAME@-devel-@PACKAGE_VERSION@-1.i586.rpm</a>
- The package for developers.
- Installation:@n <code>rpm -Uvh @PACKAGE_NAME@-devel-@PACKAGE_VERSION@-1.i586.rpm</code>
- Requirements:
- Boost thread library for multi threading:@n http://boost.org
- log4cxx for automated tracing and function traces:
- http://logging.apache.org/log4cxx
- RPM: <a href="/downloads/log4cxx-0.9.7-3.i386.rpm">log4cxx-0.9.7-3.i386.rpm</a>
- mrw::StackTrace requires:
- the GNU Binutils
- either GNU Compiler gcc or GNU C library glibc
- runs better on: either Linux or Solaris
*/
/** @page usage Usage of the Library: Include and Link

@ -46,6 +46,100 @@ namespace mrw {
*/
//@{
/** @defgroup getmax Get the Maximum of Values */
//@{
//! Get the maximum out of two values
template<typename T> T& max(T& t1, T& t2) {
return t2<t1?t1:t2;
}
//! Get the maximum out of three values
template<typename T> T& max(T& t1, T& t2, T& t3) {
return max(t1, max(t2, t3));
}
//! Get the maximum out of four values
template<typename T> T& max(T& t1, T& t2, T& t3, T& t4) {
return max(max(t1, t2), max(t3, t4));
}
//! Get the maximum out of five values
template<typename T> T& max(T& t1, T& t2, T& t3, T& t4, T& t5) {
return max(max(t1, t2), max(t3, t4, t5));
}
//! Get the maximum out of six values
template<typename T> T& max(T& t1, T& t2, T& t3, T& t4, T& t5, T& t6) {
return max(max(t1, t2, t3), max(t4, t5, t6));
}
//! Get the maximum out of two values
template<typename T> const T& max(const T& t1, const T& t2) {
return t2<t1?t1:t2;
}
//! Get the maximum out of three values
template<typename T> const T& max(const T& t1, const T& t2, const T& t3) {
return max(t1, max(t2, t3));
}
//! Get the maximum out of four values
template<typename T> const T& max(const T& t1, const T& t2, const T& t3,
const T& t4) {
return max(max(t1, t2), max(t3, t4));
}
//! Get the maximum out of five values
template<typename T> const T& max(const T& t1, const T& t2, const T& t3,
const T& t4, const T& t5) {
return max(max(t1, t2), max(t3, t4, t5));
}
//! Get the maximum out of six values
template<typename T> const T& max(const T& t1, const T& t2, const T& t3,
const T& t4, const T& t5, const T& t6) {
return max(max(t1, t2, t3), max(t4, t5, t6));
}
//@}
/** @defgroup getmin Get the Minimum of Values */
//@{
//! Get the minimum out of two values
template<typename T> T& min(T& t1, T& t2) {
return t1<t2?t1:t2;
}
//! Get the minimum out of three values
template<typename T> T& min(T& t1, T& t2, T& t3) {
return min(t1, min(t2, t3));
}
//! Get the minimum out of four values
template<typename T> T& min(T& t1, T& t2, T& t3, T& t4) {
return min(min(t1, t2), min(t3, t4));
}
//! Get the minimum out of five values
template<typename T> T& min(T& t1, T& t2, T& t3, T& t4, T& t5) {
return min(min(t1, t2), min(t3, t4, t5));
}
//! Get the minimum out of six values
template<typename T> T& min(T& t1, T& t2, T& t3, T& t4, T& t5, T& t6) {
return min(min(t1, t2, t3), min(t4, t5, t6));
}
//! Get the minimum out of two values
template<typename T> const T& min(const T& t1, const T& t2) {
return t2<t1?t1:t2;
}
//! Get the minimum out of three values
template<typename T> const T& min(const T& t1, const T& t2, const T& t3) {
return min(t1, min(t2, t3));
}
//! Get the minimum out of four values
template<typename T> const T& min(const T& t1, const T& t2, const T& t3,
const T& t4) {
return min(min(t1, t2), min(t3, t4));
}
//! Get the minimum out of five values
template<typename T> const T& min(const T& t1, const T& t2, const T& t3,
const T& t4, const T& t5) {
return min(min(t1, t2), min(t3, t4, t5));
}
//! Get the minimum out of six values
template<typename T> const T& min(const T& t1, const T& t2, const T& t3,
const T& t4, const T& t5, const T& t6) {
return min(min(t1, t2, t3), min(t4, t5, t6));
}
//@}
/** @brief Dual <code>?:</code> operation:
<code>a&nbsp;?&nbsp;a&nbsp;:&nbsp;b</code>

Loading…
Cancel
Save