]> git.lyx.org Git - lyx.git/blob - boost/boost/integer/static_min_max.hpp
update boost
[lyx.git] / boost / boost / integer / static_min_max.hpp
1 //  Boost integer/static_min_max.hpp header file  ----------------------------//
2
3 //  (C) Copyright Daryle Walker 2001.  Permission to copy, use, modify, sell
4 //  and distribute this software is granted provided this copyright notice
5 //  appears in all copies.  This software is provided "as is" without
6 //  express or implied warranty, and with no claim as to its suitability
7 //  for any purpose. 
8
9 //  See http://www.boost.org for updates, documentation, and revision history. 
10
11 #ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP
12 #define BOOST_INTEGER_STATIC_MIN_MAX_HPP
13
14 #include <boost/integer_fwd.hpp>  // self include
15
16 #include <boost/config.hpp>  // for BOOST_STATIC_CONSTANT
17
18
19 namespace boost
20 {
21
22
23 //  Compile-time extrema class declarations  ---------------------------------//
24 //  Get the minimum or maximum of two values, signed or unsigned.
25
26 template < long Value1, long Value2 >
27 struct static_signed_min
28 {
29     BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
30 };
31
32 template < long Value1, long Value2 >
33 struct static_signed_max
34 {
35     BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
36 };
37
38 template < unsigned long Value1, unsigned long Value2 >
39 struct static_unsigned_min
40 {
41     BOOST_STATIC_CONSTANT( unsigned long, value
42      = (Value1 > Value2) ? Value2 : Value1 );
43 };
44
45 template < unsigned long Value1, unsigned long Value2 >
46 struct static_unsigned_max
47 {
48     BOOST_STATIC_CONSTANT( unsigned long, value
49      = (Value1 < Value2) ? Value2 : Value1 );
50 };
51
52
53 }  // namespace boost
54
55
56 #endif  // BOOST_INTEGER_STATIC_MIN_MAX_HPP