From bd85c15a6824df2ba350239445db7fa85fb3bf56 Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 27 Jan 2001 11:31:59 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'unlabeled-1.3.2'. [SVN r8778] --- cstdint_test.cpp | 227 ----------------------- include/boost/cstdint.hpp | 301 ------------------------------- include/boost/integer.hpp | 81 --------- include/boost/integer_traits.hpp | 147 --------------- include/boost/stdint.h | 272 ---------------------------- index.htm | 98 ---------- integer.htm | 110 ----------- integer_test.cpp | 176 ------------------ integer_traits.html | 89 --------- 9 files changed, 1501 deletions(-) delete mode 100644 cstdint_test.cpp delete mode 100644 include/boost/cstdint.hpp delete mode 100644 include/boost/integer.hpp delete mode 100644 include/boost/integer_traits.hpp delete mode 100644 include/boost/stdint.h delete mode 100644 index.htm delete mode 100644 integer.htm delete mode 100644 integer_test.cpp delete mode 100644 integer_traits.html diff --git a/cstdint_test.cpp b/cstdint_test.cpp deleted file mode 100644 index 7bfa95e..0000000 --- a/cstdint_test.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// boost cstdint.hpp test program ------------------------------------------// - -// (C) Copyright Beman Dawes 2000. 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. - -// See http://www.boost.org for most recent version including documentation. - -// Revision History -// 12 Nov 00 Adapted to merged -// 23 Sep 00 Added INTXX_C constant macro support + int64_t support (John Maddock). -// 28 Jun 00 Initial version -#include -#include -#include -// -// macros should not be defined by default: -// -#ifdef INT8_C -#error header incorrectly implemented -#endif -// -// now define the macros: -// -#define __STDC_CONSTANT_MACROS -#include - -#ifdef NDEBUG -#error This test makes no sense with NDEBUG defined -#endif - -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -// -// the following class is designed to verify -// that the various INTXX_C macros can be used -// in integral constant expressions: -// -struct integral_constant_checker -{ - static const boost::int8_t int8 = INT8_C(-127); - static const boost::int_least8_t int_least8 = INT8_C(-127); - static const boost::int_fast8_t int_fast8 = INT8_C(-127); - - static const boost::uint8_t uint8 = UINT8_C(255); - static const boost::uint_least8_t uint_least8 = UINT8_C(255); - static const boost::uint_fast8_t uint_fast8 = UINT8_C(255); - - static const boost::int16_t int16 = INT16_C(-32767); - static const boost::int_least16_t int_least16 = INT16_C(-32767); - static const boost::int_fast16_t int_fast16 = INT16_C(-32767); - - static const boost::uint16_t uint16 = UINT16_C(65535); - static const boost::uint_least16_t uint_least16 = UINT16_C(65535); - static const boost::uint_fast16_t uint_fast16 = UINT16_C(65535); - - static const boost::int32_t int32 = INT32_C(-2147483647); - static const boost::int_least32_t int_least32 = INT32_C(-2147483647); - static const boost::int_fast32_t int_fast32 = INT32_C(-2147483647); - - static const boost::uint32_t uint32 = UINT32_C(4294967295); - static const boost::uint_least32_t uint_least32 = UINT32_C(4294967295); - static const boost::uint_fast32_t uint_fast32 = UINT32_C(4294967295); - - static void check(); -}; - -void integral_constant_checker::check() -{ - assert( int8 == -127 ); - assert( int_least8 == -127 ); - assert( int_fast8 == -127 ); - assert( uint8 == 255u ); - assert( uint_least8 == 255u ); - assert( uint_fast8 == 255u ); - assert( int16 == -32767 ); - assert( int_least16 == -32767 ); - assert( int_fast16 == -32767 ); - assert( uint16 == 65535u ); - assert( uint_least16 == 65535u ); - assert( uint_fast16 == 65535u ); - assert( int32 == -2147483647 ); - assert( int_least32 == -2147483647 ); - assert( int_fast32 == -2147483647 ); - assert( uint32 == 4294967295u ); - assert( uint_least32 == 4294967295u ); - assert( uint_fast32 == 4294967295u ); -} -#endif // BOOST_NO_INCLASS_MEMBER_INITIALIZATION - -// -// the following function simply verifies that the type -// of an integral constant is correctly defined: -// -#ifdef __BORLANDC__ -#pragma option -w-8008 -#pragma option -w-8066 -#endif -template -void integral_constant_type_check(T1, T2) -{ - // - // the types T1 and T2 may not be exactly - // the same type, but they should be the - // same size and signedness. We could use - // numeric_limits to verify this, but - // numeric_limits implementations currently - // vary too much, or are incomplete or missing. - // - assert(sizeof(T1) == sizeof(T2)); - T1 t1 = -1; - T2 t2 = -1; - assert(t1 == t2); - if(t1 >= 0) - assert(t2 >= 0); - else - assert(t2 < 0); -} - - -int main() -{ -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION - integral_constant_checker::check(); -#endif - // - // verify the types of the integral constants: - // - integral_constant_type_check(boost::int8_t(0), INT8_C(0)); - integral_constant_type_check(boost::uint8_t(0), UINT8_C(0)); - integral_constant_type_check(boost::int16_t(0), INT16_C(0)); - integral_constant_type_check(boost::uint16_t(0), UINT16_C(0)); - integral_constant_type_check(boost::int32_t(0), INT32_C(0)); - integral_constant_type_check(boost::uint32_t(0), UINT32_C(0)); -#ifndef BOOST_NO_INT64_T - integral_constant_type_check(boost::int64_t(0), INT64_C(0)); - integral_constant_type_check(boost::uint64_t(0), UINT64_C(0)); -#endif - // - boost::int8_t int8 = INT8_C(-127); - boost::int_least8_t int_least8 = INT8_C(-127); - boost::int_fast8_t int_fast8 = INT8_C(-127); - - boost::uint8_t uint8 = UINT8_C(255); - boost::uint_least8_t uint_least8 = UINT8_C(255); - boost::uint_fast8_t uint_fast8 = UINT8_C(255); - - boost::int16_t int16 = INT16_C(-32767); - boost::int_least16_t int_least16 = INT16_C(-32767); - boost::int_fast16_t int_fast16 = INT16_C(-32767); - - boost::uint16_t uint16 = UINT16_C(65535); - boost::uint_least16_t uint_least16 = UINT16_C(65535); - boost::uint_fast16_t uint_fast16 = UINT16_C(65535); - - boost::int32_t int32 = INT32_C(-2147483647); - boost::int_least32_t int_least32 = INT32_C(-2147483647); - boost::int_fast32_t int_fast32 = INT32_C(-2147483647); - - boost::uint32_t uint32 = UINT32_C(4294967295); - boost::uint_least32_t uint_least32 = UINT32_C(4294967295); - boost::uint_fast32_t uint_fast32 = UINT32_C(4294967295); - -#ifndef BOOST_NO_INT64_T - boost::int64_t int64 = INT64_C(-9223372036854775807); - boost::int_least64_t int_least64 = INT64_C(-9223372036854775807); - boost::int_fast64_t int_fast64 = INT64_C(-9223372036854775807); - - boost::uint64_t uint64 = UINT64_C(18446744073709551615); - boost::uint_least64_t uint_least64 = UINT64_C(18446744073709551615); - boost::uint_fast64_t uint_fast64 = UINT64_C(18446744073709551615); - - boost::intmax_t intmax = INTMAX_C(-9223372036854775807); - boost::uintmax_t uintmax = UINTMAX_C(18446744073709551615); -#else - boost::intmax_t intmax = INTMAX_C(-2147483647); - boost::uintmax_t uintmax = UINTMAX_C(4294967295); -#endif - - assert( int8 == -127 ); - assert( int_least8 == -127 ); - assert( int_fast8 == -127 ); - assert( uint8 == 255u ); - assert( uint_least8 == 255u ); - assert( uint_fast8 == 255u ); - assert( int16 == -32767 ); - assert( int_least16 == -32767 ); - assert( int_fast16 == -32767 ); - assert( uint16 == 65535u ); - assert( uint_least16 == 65535u ); - assert( uint_fast16 == 65535u ); - assert( int32 == -2147483647 ); - assert( int_least32 == -2147483647 ); - assert( int_fast32 == -2147483647 ); - assert( uint32 == 4294967295u ); - assert( uint_least32 == 4294967295u ); - assert( uint_fast32 == 4294967295u ); - -#ifndef BOOST_NO_INT64_T - assert( int64 == INT64_C(-9223372036854775807) ); - assert( int_least64 == INT64_C(-9223372036854775807) ); - assert( int_fast64 == INT64_C(-9223372036854775807) ); - assert( uint64 == UINT64_C(18446744073709551615) ); - assert( uint_least64 == UINT64_C(18446744073709551615) ); - assert( uint_fast64 == UINT64_C(18446744073709551615) ); - assert( intmax == INT64_C(-9223372036854775807) ); - assert( uintmax == UINT64_C(18446744073709551615) ); -#else - assert( intmax == -2147483647 ); - assert( uintmax == 4294967295u ); -#endif - - - std::cout << "OK\n"; - return 0; -} - -// -// now verify that constant macros get undef'ed correctly: -// -#undef __STDC_CONSTANT_MACROS -#include - -#ifdef INT8_C -#error boost/cstdint.hpp not correctly defined -#endif diff --git a/include/boost/cstdint.hpp b/include/boost/cstdint.hpp deleted file mode 100644 index 31b917d..0000000 --- a/include/boost/cstdint.hpp +++ /dev/null @@ -1,301 +0,0 @@ -// boost cstdint.hpp header file ------------------------------------------// - -// (C) Copyright boost.org 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. - -// See http://www.boost.org for most recent version including documentation. - -// Revision History -// 23 Jan 01 prefer "long" over "int" for int32_t and intmax_t (Jens Maurer) -// 12 Nov 00 Merged (Jens Maurer) -// 23 Sep 00 Added INTXX_C macro support (John Maddock). -// 22 Sep 00 Better 64-bit support (John Maddock) -// 29 Jun 00 Reimplement to avoid including stdint.h within namespace boost -// 8 Aug 99 Initial version (Beman Dawes) - - -#ifndef BOOST_CSTDINT_HPP -#define BOOST_CSTDINT_HPP - -#include - - -#ifdef BOOST_SYSTEM_HAS_STDINT_H - -# include // implementation artifact; not part of interface - -namespace boost -{ - - using ::int8_t; - using ::int_least8_t; - using ::int_fast8_t; - using ::uint8_t; - using ::uint_least8_t; - using ::uint_fast8_t; - - using ::int16_t; - using ::int_least16_t; - using ::int_fast16_t; - using ::uint16_t; - using ::uint_least16_t; - using ::uint_fast16_t; - - using ::int32_t; - using ::int_least32_t; - using ::int_fast32_t; - using ::uint32_t; - using ::uint_least32_t; - using ::uint_fast32_t; - -# ifndef BOOST_NO_INT64_T - - using ::int64_t; - using ::int_least64_t; - using ::int_fast64_t; - using ::uint64_t; - using ::uint_least64_t; - using ::uint_fast64_t; - -# endif - - using ::intmax_t; - using ::uintmax_t; - -} // namespace boost - - -#else // BOOST_SYSTEM_HAS_STDINT_H - - -# include // implementation artifact; not part of interface - - -namespace boost -{ - -// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit -// platforms. For other systems, they will have to be hand tailored. -// -// Because the fast types are assumed to be the same as the undecorated types, -// it may be possible to hand tailor a more efficient implementation. Such -// an optimization may be illusionary; on the Intel x86-family 386 on, for -// example, byte arithmetic and load/stores are as fast as "int" sized ones. - -// 8-bit types ------------------------------------------------------------// - -# if UCHAR_MAX == 0xff - typedef signed char int8_t; - typedef signed char int_least8_t; - typedef signed char int_fast8_t; - typedef unsigned char uint8_t; - typedef unsigned char uint_least8_t; - typedef unsigned char uint_fast8_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -// 16-bit types -----------------------------------------------------------// - -# if USHRT_MAX == 0xffff - typedef short int16_t; - typedef short int_least16_t; - typedef short int_fast16_t; - typedef unsigned short uint16_t; - typedef unsigned short uint_least16_t; - typedef unsigned short uint_fast16_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -// 32-bit types -----------------------------------------------------------// - -# if ULONG_MAX == 0xffffffff - typedef long int32_t; - typedef long int_least32_t; - typedef long int_fast32_t; - typedef unsigned long uint32_t; - typedef unsigned long uint_least32_t; - typedef unsigned long uint_fast32_t; -# elif UINT_MAX == 0xffffffff - typedef int int32_t; - typedef int int_least32_t; - typedef int int_fast32_t; - typedef unsigned int uint32_t; - typedef unsigned int uint_least32_t; - typedef unsigned int uint_fast32_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif - -// 64-bit types + intmax_t and uintmax_t ----------------------------------// - -# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)) -# if(defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \ - (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) - // 2**64 - 1 - typedef long long intmax_t; - typedef unsigned long long uintmax_t; - typedef long long int64_t; - typedef long long int_least64_t; - typedef long long int_fast64_t; - typedef unsigned long long uint64_t; - typedef unsigned long long uint_least64_t; - typedef unsigned long long uint_fast64_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# elif ULONG_MAX != 0xffffffff - -# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 - typedef long intmax_t; - typedef unsigned long uintmax_t; - typedef long int64_t; - typedef long int_least64_t; - typedef long int_fast64_t; - typedef unsigned long uint64_t; - typedef unsigned long uint_least64_t; - typedef unsigned long uint_fast64_t; -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# elif (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) - // - // we have Borland/Microsoft __int64: - // - typedef __int64 intmax_t; - typedef unsigned __int64 uintmax_t; - typedef __int64 int64_t; - typedef __int64 int_least64_t; - typedef __int64 int_fast64_t; - typedef unsigned __int64 uint64_t; - typedef unsigned __int64 uint_least64_t; - typedef unsigned __int64 uint_fast64_t; -# else // assume no 64-bit integers -# define BOOST_NO_INT64_T - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# endif - -} // namespace boost - - -#endif // BOOST_SYSTEM_HAS_STDINT_H - -#endif // BOOST_CSTDINT_HPP - - -/**************************************************** - -Macro definition section: - -Define various INTXX_C macros only if -__STDC_CONSTANT_MACROS is defined. - -Undefine the macros if __STDC_CONSTANT_MACROS is -not defined and the macros are (cf ). - -Added 23rd September (John Maddock). - -******************************************************/ - -#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) -# define BOOST__STDC_CONSTANT_MACROS_DEFINED -# if (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) -// -// Borland/Microsoft compilers have width specific suffixes: -// -# define INT8_C(value) value##i8 -# define INT16_C(value) value##i16 -# define INT32_C(value) value##i32 -# define INT64_C(value) value##i64 -# ifdef __BORLANDC__ - // Borland bug: appending ui8 makes the type a signed char -# define UINT8_C(value) static_cast(value##u) -# else -# define UINT8_C(value) value##ui8 -# endif -# define UINT16_C(value) value##ui16 -# define UINT32_C(value) value##ui32 -# define UINT64_C(value) value##ui64 -# define INTMAX_C(value) value##i64 -# define UINTMAX_C(value) value##ui64 - -# else -// do it the old fashioned way: - -// 8-bit types ------------------------------------------------------------// - -# if UCHAR_MAX == 0xff -# define INT8_C(value) static_cast(value) -# define UINT8_C(value) static_cast(value##u) -# endif - -// 16-bit types -----------------------------------------------------------// - -# if USHRT_MAX == 0xffff -# define INT16_C(value) static_cast(value) -# define UINT16_C(value) static_cast(value##u) -# endif - -// 32-bit types -----------------------------------------------------------// - -# if UINT_MAX == 0xffffffff -# define INT32_C(value) value -# define UINT32_C(value) value##u -# elif ULONG_MAX == 0xffffffff -# define INT32_C(value) value##L -# define UINT32_C(value) value##uL -# endif - -// 64-bit types + intmax_t and uintmax_t ----------------------------------// - -# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)) -# if(defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615) || \ - (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615) -# define INT64_C(value) value##LL -# define UINT64_C(value) value##uLL -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# elif ULONG_MAX != 0xffffffff - -# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 -# define INT64_C(value) value##L -# define UINT64_C(value) value##uL -# else -# error defaults not correct; you must hand modify boost/cstdint.hpp -# endif -# endif - -# ifdef BOOST_NO_INT64_T -# define INTMAX_C(value) INT32_C(value) -# define UINTMAX_C(value) UINT32_C(value) -# else -# define INTMAX_C(value) INT64_C(value) -# define UINTMAX_C(value) UINT64_C(value) -# endif - -# endif // Borland/Microsoft specific width suffixes - - -#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) -// -// undef all the macros: -// -# undef INT8_C -# undef INT16_C -# undef INT32_C -# undef INT64_C -# undef UINT8_C -# undef UINT16_C -# undef UINT32_C -# undef UINT64_C -# undef INTMAX_C -# undef UINTMAX_C - -#endif // __STDC_CONSTANT_MACROS_DEFINED etc. - diff --git a/include/boost/integer.hpp b/include/boost/integer.hpp deleted file mode 100644 index a5ef737..0000000 --- a/include/boost/integer.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// 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. - -// See http://www.boost.org for most recent version including documentation. - -// Revision History -// 30 Jul 00 Add typename syntax fix (Jens Maurer) -// 28 Aug 99 Initial version - -#ifndef BOOST_INTEGER_HPP -#define BOOST_INTEGER_HPP - -#include - -namespace boost -{ - - // Helper templates ------------------------------------------------------// - - // fast integers from least integers - template< typename LeastInt > - struct int_fast_t { typedef LeastInt fast; }; // imps may specialize - - // convert category to type - template< int Category > struct int_least_helper {}; // default is empty - - // specializatons: 1=long, 2=int, 3=short, 4=signed char, - // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned long - template<> struct int_least_helper<1> { typedef long least; }; - template<> struct int_least_helper<2> { typedef int least; }; - template<> struct int_least_helper<3> { typedef short least; }; - template<> struct int_least_helper<4> { typedef signed char least; }; - template<> struct int_least_helper<6> { typedef unsigned long least; }; - template<> struct int_least_helper<7> { typedef unsigned int least; }; - template<> struct int_least_helper<8> { typedef unsigned short least; }; - template<> struct int_least_helper<9> { typedef unsigned char least; }; - - // integer templates specifying number of bits ---------------------------// - - // signed - template< int Bits > // bits (including sign) required - struct int_t - { - typedef typename int_least_helper - < - (Bits-1 <= std::numeric_limits::digits) + - (Bits-1 <= std::numeric_limits::digits) + - (Bits-1 <= std::numeric_limits::digits) + - (Bits-1 <= std::numeric_limits::digits) - >::least least; - typedef typename int_fast_t::fast fast; - }; - - // unsigned - template< int Bits > // bits required - struct uint_t - { - typedef typename int_least_helper - < - 5 + - (Bits <= std::numeric_limits::digits) + - (Bits <= std::numeric_limits::digits) + - (Bits <= std::numeric_limits::digits) + - (Bits <= std::numeric_limits::digits) - >::least least; - typedef typename int_fast_t::fast fast; - }; - -// The same dispatching technique can be used to select types based on -// values. That will be added once boost::integer_traits is available. - - -} // namespace boost - -#endif // BOOST_INTEGER_HPP - diff --git a/include/boost/integer_traits.hpp b/include/boost/integer_traits.hpp deleted file mode 100644 index 8cc89d0..0000000 --- a/include/boost/integer_traits.hpp +++ /dev/null @@ -1,147 +0,0 @@ -/* boost integer_traits.hpp header file - * - * Copyright Jens Maurer 2000 - * Permission to use, copy, modify, sell, and distribute this software - * is hereby granted without free provided that the above copyright notice - * appears in all copies and that both that copyright notice and this - * permission notice appear in supporting documentation, - * - * Jens Maurer makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * $Id$ - * - * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers - */ - -#ifndef BOOST_INTEGER_TRAITS_HPP -#define BOOST_INTEGER_TRAITS_HPP - -#include -#include - -// This is an implementation detail and not part of the interface -#include - - -namespace boost { -template -class integer_traits : public std::numeric_limits -{ -public: -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION - static const bool is_integral = false; -#else - enum { is_integral = false }; -#endif -}; - -namespace detail { -template -class integer_traits_base -{ -public: -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION - static const bool is_integral = true; - static const T const_min = min_val; - static const T const_max = max_val; -#else - enum { - is_integral = true, - const_min = min_val, - const_max = max_val - }; -#endif -}; -} // namespace detail - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -// What about wchar_t ? - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -#ifdef ULLONG_MAX -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; -#elif defined(ULONG_LONG_MAX) -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; -#endif - -} // namespace boost - -#endif /* BOOST_INTEGER_TRAITS_HPP */ diff --git a/include/boost/stdint.h b/include/boost/stdint.h deleted file mode 100644 index a2a69d2..0000000 --- a/include/boost/stdint.h +++ /dev/null @@ -1,272 +0,0 @@ -// boost stdint.h header file ---------------------------------------------// - -// (C) Copyright boost.org 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. - -// See http://www.boost.org for most recent version including documentation. - -// NOTE WELL: This is an implementation of the ISO C Standard (1999) stdint.h -// header. C++ programs are advised to use rather than -// this header. - -// NOTE OF OBSOLESCENCE: In general, this header file cannot detect -// whether the current translation unit somewhere includes ISO C99 -// or not. For example, in case BOOST_SYSTEM_HAS_STDINT_H -// is not defined and ISO C99 has been included before, -// this file will re-define ISO C99 reserved file-scope identifiers -// such as int8_t (see ISO C99 7.1.3 and 7.18). Defining the macro -// BOOST_SYSTEM_HAS_STDINT_H is not sufficient in general, in -// particular if a partly conformant header is available -// on the platform, e.g. Comeau C++ with GNU glibc 2.1.2. -// -// In order to avoid incompatibilities with ISO C99, this header -// should not be used at all, and it may be deleted in the future. -// C++ programs which require ISO C99 functionality are -// strongly advised to use instead, which -// provides names in namespace boost, e.g. boost::int8_t. - - -// Revision History -// 12 Nov 00 obsoleted (Jens Maurer) -// 23 Sep 00 INTXX_C support added (John Maddock) -// 22 Sep 00 64-bit support for Borland & Microsoft compilers (John Maddock) -// 8 Aug 99 Initial version (Beman Dawes) - -#ifndef BOOST_STDINT_H -#define BOOST_STDINT_H - -#include - -#ifdef BOOST_SYSTEM_HAS_STDINT_H -#include - -#else - -#include // implementation artifact; not part of interface - -// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit -// platforms. For other systems, they will have to be hand tailored. -// -// Because the fast types are assumed to be the same as the undecorated types, -// it may be possible to hand tailor a more efficient implementation. Such -// an optimization may be illusionary; on the Intel x86-family 386 on, for -// example, byte arithmetic and load/stores are as fast as "int" sized ones. - -// 8-bit types -------------------------------------------------------------// - -# if UCHAR_MAX == 0xff - typedef signed char int8_t; - typedef signed char int_least8_t; - typedef signed char int_fast8_t; - typedef unsigned char uint8_t; - typedef unsigned char uint_least8_t; - typedef unsigned char uint_fast8_t; -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif - -// 16-bit types ------------------------------------------------------------// - -# if USHRT_MAX == 0xffff - typedef short int16_t; - typedef short int_least16_t; - typedef short int_fast16_t; - typedef unsigned short uint16_t; - typedef unsigned short uint_least16_t; - typedef unsigned short uint_fast16_t; -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif - -// 32-bit types ------------------------------------------------------------// - -# if UINT_MAX == 0xffffffff - typedef int int32_t; - typedef int int_least32_t; - typedef int int_fast32_t; - typedef unsigned int uint32_t; - typedef unsigned int uint_least32_t; - typedef unsigned int uint_fast32_t; -# elif ULONG_MAX == 0xffffffff - typedef long int32_t; - typedef long int_least32_t; - typedef long int_fast32_t; - typedef unsigned long uint32_t; - typedef unsigned long uint_least32_t; - typedef unsigned long uint_fast32_t; -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif - -// 64-bit types + intmax_t and uintmax_t -----------------------------------// - -# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)) && !(defined(_WIN32) && defined(__GNUC__)) -# if(defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615) || \ - (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615) - // 2**64 - 1 - typedef long long intmax_t; - typedef unsigned long long uintmax_t; - typedef long long int64_t; - typedef long long int_least64_t; - typedef long long int_fast64_t; - typedef unsigned long long uint64_t; - typedef unsigned long long uint_least64_t; - typedef unsigned long long uint_fast64_t; -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif -# elif ULONG_MAX != 0xffffffff - -# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 - typedef long intmax_t; - typedef unsigned long uintmax_t; - typedef long int64_t; - typedef long int_least64_t; - typedef long int_fast64_t; - typedef unsigned long uint64_t; - typedef unsigned long uint_least64_t; - typedef unsigned long uint_fast64_t; -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif -# elif (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) - // - // we have Borland/Microsoft __int64: - // - typedef __int64 intmax_t; - typedef unsigned __int64 uintmax_t; - typedef __int64 int64_t; - typedef __int64 int_least64_t; - typedef __int64 int_fast64_t; - typedef unsigned __int64 uint64_t; - typedef unsigned __int64 uint_least64_t; - typedef unsigned __int64 uint_fast64_t; -# else // assume no 64-bit integers -#define BOOST_NO_INT64_T - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# endif - -#endif // BOOST_SYSTEM_HAS_STDINT_H not defined -#endif // BOOST_STDINT_H - -/**************************************************** - -Macro definition section: - -Define various INTXX_C macros only if -__STDC_CONSTANT_MACROS is defined. - -Undefine the macros if __STDC_CONSTANT_MACROS is -not defined and the macros are (cf ). - -Added 23rd September (John Maddock). - -******************************************************/ - -#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) -#define BOOST__STDC_CONSTANT_MACROS_DEFINED -#if (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) -// -// Borland/Microsoft compilers have width specific suffixes: -// -#define INT8_C(value) value##i8 -#define INT16_C(value) value##i16 -#define INT32_C(value) value##i32 -#define INT64_C(value) value##i64 -#ifdef __BORLANDC__ -// Borland bug: appending ui8 makes the type -// a signed char!!!! -#define UINT8_C(value) static_cast(value##u) -#else -#define UINT8_C(value) value##ui8 -#endif -#define UINT16_C(value) value##ui16 -#define UINT32_C(value) value##ui32 -#define UINT64_C(value) value##ui64 -#define INTMAX_C(value) value##i64 -#define UINTMAX_C(value) value##ui64 - -#else -// do it the old fashioned way: -// 8-bit types -------------------------------------------------------------// - -# if UCHAR_MAX == 0xff -#define INT8_C(value) static_cast(value) -#define UINT8_C(value) static_cast(value##u) -# endif - -// 16-bit types ------------------------------------------------------------// - -# if USHRT_MAX == 0xffff -#define INT16_C(value) static_cast(value) -#define UINT16_C(value) static_cast(value##u) -# endif - -// 32-bit types ------------------------------------------------------------// - -# if UINT_MAX == 0xffffffff -#define INT32_C(value) value -#define UINT32_C(value) value##u -# elif ULONG_MAX == 0xffffffff -#define INT32_C(value) value##L -#define UINT32_C(value) value##uL -# endif - -// 64-bit types + intmax_t and uintmax_t -----------------------------------// - -# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)) && !(defined(_WIN32) && defined(__GNUC__)) -# if(defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615) || \ - (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615) -#define INT64_C(value) value##LL -#define UINT64_C(value) value##uLL -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif -# elif ULONG_MAX != 0xffffffff - -# if ULONG_MAX == 18446744073709551615 // 2**64 - 1 -#define INT64_C(value) value##L -#define UINT64_C(value) value##uL -# else -# error defaults not correct; you must hand modify boost/stdint.h -# endif -# elif (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) - // - // we have Borland/Microsoft __int64: - // -#define INT64_C(value) value##i64 -#define UINT64_C(value) value##ui64 -# endif - -#ifdef BOOST_NO_INT64_T -#define INTMAX_C(value) INT32_C(value) -#define UINTMAX_C(value) UINT32_C(value) -#else -#define INTMAX_C(value) INT64_C(value) -#define UINTMAX_C(value) UINT64_C(value) -#endif - -#endif // Borland/MS specific - -#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) -// -// undef all the macros: -// -#undef INT8_C -#undef INT16_C -#undef INT32_C -#undef INT64_C -#undef UINT8_C -#undef UINT16_C -#undef UINT32_C -#undef UINT64_C -#undef INTMAX_C -#undef UINTMAX_C - -#endif // constant macros - - diff --git a/index.htm b/index.htm deleted file mode 100644 index 8b3ffed..0000000 --- a/index.htm +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Boost Integer Library - - - - - - - - - - - - - -
c++boost.gif (8819 bytes)Home Libraries People FAQ More
- -

Boost Integer Library

- - - - - - - - - - - - - - - - - - - - - - -
Header / DocsContentsUse
<boost/cstdint.hpp>
-

- documentation
-
Typedef's based on the 1999 C Standard header <stdint.h>, wrapped in namespace boost. - This implementation may #include the compiler - supplied <stdint.h>, if present. Supplies typedefs for standard integer types such as int32_t or uint_least16_t. - Use in preference to <stdint.h> - for enhanced portability. Furthermore, all names are safely placed in the boost namespace.
<boost/integer_traits.hpp>
-
- documentation -
Template class boost::integer_traits, derived from std::numeric_limits.  - Adds const_min and const_max members.Use to obtain the characteristics of a known integer type.
<boost/integer.hpp>
-
-
documentation
Templates for integer type selection based on properties such as - maximum value or number of bits.Use to select the type an integer when some property such as maximum value or number of bits is known. - Useful for generic programming.
- -

Rationale

-

The organization of boost integer headers and classes is designed to take -advantage of <stdint.h> types from the 1999 C standard -without resorting to undefined behavior in terms of -the 1998 C++ standard.  The header <boost/cstdint.hpp> -makes the standard integer types safely available in namespace boost without placing any names in namespace std. As always, the intension is to complement rather than -compete with the C++ Standard Library.  Should some future C++ standard -include <stdint.h> and <cstdint>, then <boost/cstdint.hpp> -will continue to function, but will become redundant and may be safely deprecated.

-

Because these are boost headers, their names conform to boost header naming -conventions rather than C++ Standard Library header naming conventions. - -

Caveat emptor

-

As an - implementation artifact, certain C <limits.h> macro names may possibly be -visible to users of <boost/cstdint.hpp>.  Don't use these macros; they are not part of -any Boost specified interface.  - Use boost:: integer_traits<> or std::numeric_limits<> instead.

- -

-As another implementation artifact, certain C -<stdint.h> typedef names may possibly be visible in the -global namespace to users of <boost/cstdint.hpp>. -Don't use these names, they are not part of any Boost specified -interface. Use the respective names in namespace boost -instead. - -


- -

Revised: 14 Nov 2000 -

- - - - diff --git a/integer.htm b/integer.htm deleted file mode 100644 index 9dc16a1..0000000 --- a/integer.htm +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - -Integer Type Selection Templates - - - - -

c++boost.gif (8819 bytes)Integer -Type Selection Templates

-

The <boost/integer.hpp> -type selection templates allow integer types to be selected based on desired -characteristics such as number of bits or maximum value.  This facility is -particularly useful for solving generic programming problems.

- -

The templates int_t<> and uint_t<> supply typedefs least -and fast.  The least type be the smallest type which holds at -least the number of bits (including sign) specified. The fast type will -be at least as large as the least type, but may possible be larger.  -There is no guarantee that the fast type will actually be faster than -other possible types.

- -

Alternative

- -

If the number of bits required is known beforehand, it may be more -appropriate to use the types supplied in <boost/cstdint.hpp>.

- -

Synopsis

- -
-
namespace boost
-{
-  //  fast integers from least integers
-  template< typename LeastInt >  // Required: LeastInt is integral type, not bool
-  struct int_fast_t { typedef LeastInt fast; }; // implementations may specialize
-
-  //  signed
-  template< int Bits >   // bits (including sign) required, 0-32 valid
-  struct int_t 
-  {
-      typedef implementation-supplied  least;
-      typedef int_fast_t<least>::fast  fast;
-  };
-
-  //  unsigned
-  template< int Bits >   // bits required, 0-32 valid
-  struct uint_t 
-  {
-      typedef implementation-supplied  least;
-      typedef int_fast_t<least>::fast  fast;
-  };
-} // namespace boost
-
- -
-

[Templates to select type based on maximum value are under development.] -

- -

Example

- -
-
#include <boost/integer.hpp>
-using boost::int_t;
-
-...
-int_t<24>::least my_var;  
- -
-

Demonstration Program

- -

The program integer_test.cpp is a not very -smart demonstration of the results from instantiating various int_t<> -and uint_t<> examples.

- -

Rationale

- -

The rationale for the design of the templates in this header includes:

- -
    -
  • Avoid  recursion because of concern about C++'s limited guaranteed - recursion depth (17).
  • -
  • Avoid macros on general principles.
  • -
  • Try to keep the design as simple as possible.
  • -
- -

Credits

- -

The author of the Boost integer type choosing templates is Beman -Dawes.  He thanks to Valentin Bonnard and - Kevlin Henney for sharing their designs for similar templates.

- -
- -

Revised  August 31, 1999

- -

© Copyright Beman Dawes 1999. Permission to copy, use, modify, sell -and distribute this document is granted provided this copyright notice appears in all -copies. This document is provided "as is" without express or implied warranty, -and with no claim as to its suitability for any purpose.

- -

- -

 

- - - - diff --git a/integer_test.cpp b/integer_test.cpp deleted file mode 100644 index 1bf96ba..0000000 --- a/integer_test.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// boost integer.hpp test program ------------------------------------------// - -// (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. - -// See http://www.boost.org for most recent version including documentation. - -// Revision History -// 31 Aug 99 Initial version - -// This program is misnamed in that it is really a demonstration rather than -// a test. It doesn't detect failure, so isn't worthy of the name "test". - -#include -#include - -namespace -{ - void test( long ) { std::cout << "long\n"; } - void test( int ) { std::cout << "int\n"; } - void test( short ) { std::cout << "short\n"; } - void test( signed char ) { std::cout << "signed char\n"; } - void test( unsigned long ) { std::cout << "unsigned long\n"; } - void test( unsigned int ) { std::cout << "unsigned int\n"; } - void test( unsigned short ) { std::cout << "unsigned short\n"; } - void test( unsigned char ) { std::cout << "unsigned char\n"; } -} // unnamed namespace - -// just to prove it works, specialize int_fast_t to yield long -namespace boost -{ - template<> struct int_fast_t { typedef long fast; }; -} - -int main() -{ - using boost::int_t; - using boost::uint_t; - std::cout << 32 << ' '; test( int_t<32>::least() ); - std::cout << 31 << ' '; test( int_t<31>::least() ); - std::cout << 30 << ' '; test( int_t<30>::least() ); - std::cout << 29 << ' '; test( int_t<29>::least() ); - std::cout << 28 << ' '; test( int_t<28>::least() ); - std::cout << 27 << ' '; test( int_t<27>::least() ); - std::cout << 26 << ' '; test( int_t<26>::least() ); - std::cout << 25 << ' '; test( int_t<25>::least() ); - std::cout << 24 << ' '; test( int_t<24>::least() ); - std::cout << 23 << ' '; test( int_t<23>::least() ); - std::cout << 22 << ' '; test( int_t<22>::least() ); - std::cout << 21 << ' '; test( int_t<21>::least() ); - std::cout << 20 << ' '; test( int_t<20>::least() ); - std::cout << 19 << ' '; test( int_t<19>::least() ); - std::cout << 18 << ' '; test( int_t<18>::least() ); - std::cout << 17 << ' '; test( int_t<17>::least() ); - std::cout << 16 << ' '; test( int_t<16>::least() ); - std::cout << 15 << ' '; test( int_t<15>::least() ); - std::cout << 14 << ' '; test( int_t<14>::least() ); - std::cout << 13 << ' '; test( int_t<13>::least() ); - std::cout << 12 << ' '; test( int_t<12>::least() ); - std::cout << 11 << ' '; test( int_t<11>::least() ); - std::cout << 10 << ' '; test( int_t<10>::least() ); - std::cout << 9 << ' '; test( int_t<9>::least() ); - std::cout << 8 << ' '; test( int_t<8>::least() ); - std::cout << 7 << ' '; test( int_t<7>::least() ); - std::cout << 6 << ' '; test( int_t<6>::least() ); - std::cout << 5 << ' '; test( int_t<5>::least() ); - std::cout << 4 << ' '; test( int_t<4>::least() ); - std::cout << 3 << ' '; test( int_t<3>::least() ); - std::cout << 2 << ' '; test( int_t<2>::least() ); - std::cout << 1 << ' '; test( int_t<1>::least() ); - std::cout << 0 << ' '; test( int_t<0>::least() ); - std::cout << 32 << ' '; test( int_t<32>::fast() ); - std::cout << 31 << ' '; test( int_t<31>::fast() ); - std::cout << 30 << ' '; test( int_t<30>::fast() ); - std::cout << 29 << ' '; test( int_t<29>::fast() ); - std::cout << 28 << ' '; test( int_t<28>::fast() ); - std::cout << 27 << ' '; test( int_t<27>::fast() ); - std::cout << 26 << ' '; test( int_t<26>::fast() ); - std::cout << 25 << ' '; test( int_t<25>::fast() ); - std::cout << 24 << ' '; test( int_t<24>::fast() ); - std::cout << 23 << ' '; test( int_t<23>::fast() ); - std::cout << 22 << ' '; test( int_t<22>::fast() ); - std::cout << 21 << ' '; test( int_t<21>::fast() ); - std::cout << 20 << ' '; test( int_t<20>::fast() ); - std::cout << 19 << ' '; test( int_t<19>::fast() ); - std::cout << 18 << ' '; test( int_t<18>::fast() ); - std::cout << 17 << ' '; test( int_t<17>::fast() ); - std::cout << 16 << ' '; test( int_t<16>::fast() ); - std::cout << 15 << ' '; test( int_t<15>::fast() ); - std::cout << 14 << ' '; test( int_t<14>::fast() ); - std::cout << 13 << ' '; test( int_t<13>::fast() ); - std::cout << 12 << ' '; test( int_t<12>::fast() ); - std::cout << 11 << ' '; test( int_t<11>::fast() ); - std::cout << 10 << ' '; test( int_t<10>::fast() ); - std::cout << 9 << ' '; test( int_t<9>::fast() ); - std::cout << 8 << ' '; test( int_t<8>::fast() ); - std::cout << 7 << ' '; test( int_t<7>::fast() ); - std::cout << 6 << ' '; test( int_t<6>::fast() ); - std::cout << 5 << ' '; test( int_t<5>::fast() ); - std::cout << 4 << ' '; test( int_t<4>::fast() ); - std::cout << 3 << ' '; test( int_t<3>::fast() ); - std::cout << 2 << ' '; test( int_t<2>::fast() ); - std::cout << 1 << ' '; test( int_t<1>::fast() ); - std::cout << 0 << ' '; test( int_t<0>::fast() ); - std::cout << 32 << ' '; test( uint_t<32>::least() ); - std::cout << 31 << ' '; test( uint_t<31>::least() ); - std::cout << 30 << ' '; test( uint_t<30>::least() ); - std::cout << 29 << ' '; test( uint_t<29>::least() ); - std::cout << 28 << ' '; test( uint_t<28>::least() ); - std::cout << 27 << ' '; test( uint_t<27>::least() ); - std::cout << 26 << ' '; test( uint_t<26>::least() ); - std::cout << 25 << ' '; test( uint_t<25>::least() ); - std::cout << 24 << ' '; test( uint_t<24>::least() ); - std::cout << 23 << ' '; test( uint_t<23>::least() ); - std::cout << 22 << ' '; test( uint_t<22>::least() ); - std::cout << 21 << ' '; test( uint_t<21>::least() ); - std::cout << 20 << ' '; test( uint_t<20>::least() ); - std::cout << 19 << ' '; test( uint_t<19>::least() ); - std::cout << 18 << ' '; test( uint_t<18>::least() ); - std::cout << 17 << ' '; test( uint_t<17>::least() ); - std::cout << 16 << ' '; test( uint_t<16>::least() ); - std::cout << 15 << ' '; test( uint_t<15>::least() ); - std::cout << 14 << ' '; test( uint_t<14>::least() ); - std::cout << 13 << ' '; test( uint_t<13>::least() ); - std::cout << 12 << ' '; test( uint_t<12>::least() ); - std::cout << 11 << ' '; test( uint_t<11>::least() ); - std::cout << 10 << ' '; test( uint_t<10>::least() ); - std::cout << 9 << ' '; test( uint_t<9>::least() ); - std::cout << 8 << ' '; test( uint_t<8>::least() ); - std::cout << 7 << ' '; test( uint_t<7>::least() ); - std::cout << 6 << ' '; test( uint_t<6>::least() ); - std::cout << 5 << ' '; test( uint_t<5>::least() ); - std::cout << 4 << ' '; test( uint_t<4>::least() ); - std::cout << 3 << ' '; test( uint_t<3>::least() ); - std::cout << 2 << ' '; test( uint_t<2>::least() ); - std::cout << 1 << ' '; test( uint_t<1>::least() ); - std::cout << 0 << ' '; test( uint_t<0>::least() ); - std::cout << 32 << ' '; test( uint_t<32>::fast() ); - std::cout << 31 << ' '; test( uint_t<31>::fast() ); - std::cout << 30 << ' '; test( uint_t<30>::fast() ); - std::cout << 29 << ' '; test( uint_t<29>::fast() ); - std::cout << 28 << ' '; test( uint_t<28>::fast() ); - std::cout << 27 << ' '; test( uint_t<27>::fast() ); - std::cout << 26 << ' '; test( uint_t<26>::fast() ); - std::cout << 25 << ' '; test( uint_t<25>::fast() ); - std::cout << 24 << ' '; test( uint_t<24>::fast() ); - std::cout << 23 << ' '; test( uint_t<23>::fast() ); - std::cout << 22 << ' '; test( uint_t<22>::fast() ); - std::cout << 21 << ' '; test( uint_t<21>::fast() ); - std::cout << 20 << ' '; test( uint_t<20>::fast() ); - std::cout << 19 << ' '; test( uint_t<19>::fast() ); - std::cout << 18 << ' '; test( uint_t<18>::fast() ); - std::cout << 17 << ' '; test( uint_t<17>::fast() ); - std::cout << 16 << ' '; test( uint_t<16>::fast() ); - std::cout << 15 << ' '; test( uint_t<15>::fast() ); - std::cout << 14 << ' '; test( uint_t<14>::fast() ); - std::cout << 13 << ' '; test( uint_t<13>::fast() ); - std::cout << 12 << ' '; test( uint_t<12>::fast() ); - std::cout << 11 << ' '; test( uint_t<11>::fast() ); - std::cout << 10 << ' '; test( uint_t<10>::fast() ); - std::cout << 9 << ' '; test( uint_t<9>::fast() ); - std::cout << 8 << ' '; test( uint_t<8>::fast() ); - std::cout << 7 << ' '; test( uint_t<7>::fast() ); - std::cout << 6 << ' '; test( uint_t<6>::fast() ); - std::cout << 5 << ' '; test( uint_t<5>::fast() ); - std::cout << 4 << ' '; test( uint_t<4>::fast() ); - std::cout << 3 << ' '; test( uint_t<3>::fast() ); - std::cout << 2 << ' '; test( uint_t<2>::fast() ); - std::cout << 1 << ' '; test( uint_t<1>::fast() ); - std::cout << 0 << ' '; test( uint_t<0>::fast() ); - - return 0; -} diff --git a/integer_traits.html b/integer_traits.html deleted file mode 100644 index 1f52f84..0000000 --- a/integer_traits.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - - -integer_traits: Compile-Time Limits for Integral Types - - - - -

c++boost.gif (8819 bytes)Compile-Time Integral -Type Limits

- -

-The C++ Standard Library <limits> header supplies a class template -numeric_limits<> with specializations for each fundamental -type.

-

-For integer types, the interesting members of std::numeric_limits<> are: -

   static const bool is_specialized; // will be true for integers
-   static T min() throw();
-   static T max() throw();
-   static const int digits;     // for integers, # value bits
-   static const int digits10;     
-   static const bool is_signed;
-   static const bool is_integer; // will be true for integers
-For many uses, these are sufficient. But min() and max() are problematical because they are not constant expressions -(std::5.19), yet some usages require constant expressions. -

-The template class integer_traits addresses this -problem. - - -

Header integer_traits.hpp Synopsis

- -
namespace boost {
-  template<class T>
-  class integer_traits : public std::numeric_limits<T>
-  {
-    static const bool is_integral = false;
-  };
-
-  // specializations for all integral types
-}
- - -

Description

- -Template class integer_traits is derived from -std::numeric_limits. In general, it adds the single -bool member is_integral with the -compile-time constant value false. However, for all -integral types T (std::3.9.1/7 [basic.fundamental]), -there are specializations provided with the following compile-time -constants defined: -

- - - - - -
membertypevalue
is_integralbooltrue
const_minTequivalent -to std::numeric_limits<T>::min()
const_maxTequivalent -to std::numeric_limits<T>::max()
- -

- -Note: A flag is_integral is provided, because a -user-defined integer class should specialize -std::numeric_limits<>::is_integer = true, -nonetheless compile-time constants const_min and -const_max cannot be provided for that user-defined class. - -

- -Test Program

- -

- -The program integer_traits_test.cpp -exercises the integer_traits class. - -

Acknowledgements

- -Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers discussed the integer -traits idea on the boost mailing list in August 1999. -
- -Jens Maurer, 2000-02-20 \ No newline at end of file