L4Re - L4 Runtime Environment
minmax
1 // vi:set ft=cpp: -*- Mode: C++ -*-
2 /*
3  * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
4  * economic rights: Technische Universit├Ąt Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  *
10  * As a special exception, you may use this file as part of a free software
11  * library without restriction. Specifically, if other files instantiate
12  * templates or use macros or inline functions from this file, or you compile
13  * this file and link it with other files to produce an executable, this
14  * file does not by itself cause the resulting executable to be covered by
15  * the GNU General Public License. This exception does not however
16  * invalidate any other reasons why the executable file might be covered by
17  * the GNU General Public License.
18  */
19 
20 #pragma once
21 /**
22  * \ingroup cxx_api
23  * \brief Various kinds of C++ utilities.
24  */
25 namespace cxx
26 {
27  /**
28  * \ingroup cxx_api
29  * \brief Get the minimum of \a a and \a b.
30  * \param a the first value.
31  * \param b the second value.
32  */
33  template< typename T1 >
34  inline
35  T1 min(T1 a, T1 b) { return a<b?a:b;}
36 
37  /**
38  * \ingroup cxx_api
39  * \brief Get the maximum of \a a and \a b.
40  * \param a the first value.
41  * \param b the second value.
42  */
43  template< typename T1 >
44  inline
45  T1 max(T1 a, T1 b) { return a>b?a:b;}
46 };
47 
48