Overview   API Reference  

static_min_max.hpp

00001 //  Boost integer/static_min_max.hpp header file  ----------------------------//
00002 
00003 //  (C) Copyright Daryle Walker 2001.
00004 //  Distributed under the Boost Software License, Version 1.0. (See
00005 //  accompanying file LICENSE_1_0.txt or copy at
00006 //  http://www.boost.org/LICENSE_1_0.txt)
00007 
00008 //  See http://www.boost.org for updates, documentation, and revision history. 
00009 
00010 #ifndef BOOST_INTEGER_STATIC_MIN_MAX_HPP
00011 #define BOOST_INTEGER_STATIC_MIN_MAX_HPP
00012 
00013 #include <boost/integer_fwd.hpp>  // self include
00014 
00015 #include <boost/config.hpp>  // for BOOST_STATIC_CONSTANT
00016 
00017 
00018 namespace boost
00019 {
00020 
00021 
00022 //  Compile-time extrema class declarations  ---------------------------------//
00023 //  Get the minimum or maximum of two values, signed or unsigned.
00024 
00025 template < long Value1, long Value2 >
00026 struct static_signed_min
00027 {
00028     BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
00029 };
00030 
00031 template < long Value1, long Value2 >
00032 struct static_signed_max
00033 {
00034     BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
00035 };
00036 
00037 template < unsigned long Value1, unsigned long Value2 >
00038 struct static_unsigned_min
00039 {
00040     BOOST_STATIC_CONSTANT( unsigned long, value
00041      = (Value1 > Value2) ? Value2 : Value1 );
00042 };
00043 
00044 template < unsigned long Value1, unsigned long Value2 >
00045 struct static_unsigned_max
00046 {
00047     BOOST_STATIC_CONSTANT( unsigned long, value
00048      = (Value1 < Value2) ? Value2 : Value1 );
00049 };
00050 
00051 
00052 }  // namespace boost
00053 
00054 
00055 #endif  // BOOST_INTEGER_STATIC_MIN_MAX_HPP

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008