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