]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/integer.hpp
* lib/doc/Makefile.am:
[lyx.git] / boost / boost / integer.hpp
index c5516fe69a25cbbc9e2fa22d30b02bb56f4e5591..aa8b22c508c6aad2103afdd77f077b762c95d300 100644 (file)
@@ -1,14 +1,13 @@
 //  boost integer.hpp header file  -------------------------------------------//
 
-//  (C) Copyright Beman Dawes 1999. Permission to copy, use, modify, sell
-//  and distribute this software is granted provided this copyright
-//  notice appears in all copies. This software is provided "as is" without
-//  express or implied warranty, and with no claim as to its suitability for
-//  any purpose.
+//  Copyright Beman Dawes and Daryle Walker 1999.  Distributed under the Boost
+//  Software License, Version 1.0. (See accompanying file
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-//  See http://www.boost.org for most recent version including documentation.
+//  See http://www.boost.org/libs/integer for documentation.
 
 //  Revision History
+//   22 Sep 01  Added value-based integer templates. (Daryle Walker)
 //   01 Apr 01  Modified to use new <boost/limits.hpp> header. (John Maddock)
 //   30 Jul 00  Add typename syntax fix (Jens Maurer)
 //   28 Aug 99  Initial version
 #ifndef BOOST_INTEGER_HPP
 #define BOOST_INTEGER_HPP
 
-#include <boost/limits.hpp>
+#include <boost/integer_fwd.hpp>  // self include
+
+#include <boost/integer_traits.hpp>  // for boost::integer_traits
+#include <boost/limits.hpp>          // for std::numeric_limits
 
 namespace boost
 {
@@ -75,11 +77,51 @@ namespace boost
       // int_fast_t<> works correctly for unsigned too, in spite of the name.
   };
 
-//  The same dispatching technique can be used to select types based on
-//  values.  That will be added once boost::integer_traits is available.
+  //  integer templates specifying extreme value  ----------------------------//
+
+  //  signed
+  template< long MaxValue >   // maximum value to require support
+  struct int_max_value_t 
+  {
+      typedef typename int_least_helper
+        <
+          (MaxValue <= integer_traits<long>::const_max) +
+          (MaxValue <= integer_traits<int>::const_max) +
+          (MaxValue <= integer_traits<short>::const_max) +
+          (MaxValue <= integer_traits<signed char>::const_max)
+        >::least  least;
+      typedef typename int_fast_t<least>::fast  fast;
+  };
+
+  template< long MinValue >   // minimum value to require support
+  struct int_min_value_t 
+  {
+      typedef typename int_least_helper
+        <
+          (MinValue >= integer_traits<long>::const_min) +
+          (MinValue >= integer_traits<int>::const_min) +
+          (MinValue >= integer_traits<short>::const_min) +
+          (MinValue >= integer_traits<signed char>::const_min)
+        >::least  least;
+      typedef typename int_fast_t<least>::fast  fast;
+  };
+
+  //  unsigned
+  template< unsigned long Value >   // maximum value to require support
+  struct uint_value_t 
+  {
+      typedef typename int_least_helper
+        < 
+          5 +
+          (Value <= integer_traits<unsigned long>::const_max) +
+          (Value <= integer_traits<unsigned int>::const_max) +
+          (Value <= integer_traits<unsigned short>::const_max) +
+          (Value <= integer_traits<unsigned char>::const_max)
+        >::least  least;
+      typedef typename int_fast_t<least>::fast  fast;
+  };
 
 
 } // namespace boost
 
 #endif  // BOOST_INTEGER_HPP
-