1 // Boost integer/static_min_max.hpp header file ----------------------------//
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
9 // See http://www.boost.org for updates, documentation, and revision history.
11 #ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP
12 #define BOOST_INTEGER_STATIC_MIN_MAX_HPP
14 #include <boost/integer_fwd.hpp> // self include
16 #include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
23 // Compile-time extrema class declarations ---------------------------------//
24 // Get the minimum or maximum of two values, signed or unsigned.
26 template < long Value1, long Value2 >
27 struct static_signed_min
29 BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
32 template < long Value1, long Value2 >
33 struct static_signed_max
35 BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
38 template < unsigned long Value1, unsigned long Value2 >
39 struct static_unsigned_min
41 BOOST_STATIC_CONSTANT( unsigned long, value
42 = (Value1 > Value2) ? Value2 : Value1 );
45 template < unsigned long Value1, unsigned long Value2 >
46 struct static_unsigned_max
48 BOOST_STATIC_CONSTANT( unsigned long, value
49 = (Value1 < Value2) ? Value2 : Value1 );
56 #endif // BOOST_INTEGER_STATIC_MIN_MAX_HPP