source: NonGTP/Boost/boost/integer/static_min_max.hpp @ 857

Revision 857, 1.5 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[857]1//  Boost integer/static_min_max.hpp header file  ----------------------------//
2
3//  (C) Copyright Daryle Walker 2001.
4//  Distributed under the Boost Software License, Version 1.0. (See
5//  accompanying file LICENSE_1_0.txt or copy at
6//  http://www.boost.org/LICENSE_1_0.txt)
7
8//  See http://www.boost.org for updates, documentation, and revision history.
9
10#ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP
11#define BOOST_INTEGER_STATIC_MIN_MAX_HPP
12
13#include <boost/integer_fwd.hpp>  // self include
14
15#include <boost/config.hpp>  // for BOOST_STATIC_CONSTANT
16
17
18namespace boost
19{
20
21
22//  Compile-time extrema class declarations  ---------------------------------//
23//  Get the minimum or maximum of two values, signed or unsigned.
24
25template < long Value1, long Value2 >
26struct static_signed_min
27{
28    BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
29};
30
31template < long Value1, long Value2 >
32struct static_signed_max
33{
34    BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
35};
36
37template < unsigned long Value1, unsigned long Value2 >
38struct static_unsigned_min
39{
40    BOOST_STATIC_CONSTANT( unsigned long, value
41     = (Value1 > Value2) ? Value2 : Value1 );
42};
43
44template < unsigned long Value1, unsigned long Value2 >
45struct static_unsigned_max
46{
47    BOOST_STATIC_CONSTANT( unsigned long, value
48     = (Value1 < Value2) ? Value2 : Value1 );
49};
50
51
52}  // namespace boost
53
54
55#endif  // BOOST_INTEGER_STATIC_MIN_MAX_HPP
Note: See TracBrowser for help on using the repository browser.