mirror of
https://github.com/boostorg/config.git
synced 2026-03-07 14:24:10 +01:00
Compare commits
69 Commits
boost-1.20
...
boost-1.23
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7accbdfd4 | ||
|
|
cc064675a6 | ||
|
|
417ec50c39 | ||
|
|
caef31de2a | ||
|
|
c1222123b3 | ||
|
|
99f61828d5 | ||
|
|
1e3a4a1e54 | ||
|
|
24a6f03ce7 | ||
|
|
61125a8339 | ||
|
|
d471920ae8 | ||
|
|
ea50a67139 | ||
|
|
3c211cf52a | ||
|
|
fb63ddc2e0 | ||
|
|
b96be9d81c | ||
|
|
cf8041403b | ||
|
|
e6858c8534 | ||
|
|
8ac22ab75d | ||
|
|
3e35f9e861 | ||
|
|
aeee4bea2e | ||
|
|
b700c25f06 | ||
|
|
20439e1aef | ||
|
|
3987d988e0 | ||
|
|
11291104a5 | ||
|
|
bd702153cb | ||
|
|
74a8ab80e5 | ||
|
|
3fe7088cda | ||
|
|
7e2fb0aa47 | ||
|
|
b16b2e09e8 | ||
|
|
7ac6ca8360 | ||
|
|
f098db79ff | ||
|
|
1f933d75a5 | ||
|
|
326ca342c6 | ||
|
|
66a206af29 | ||
|
|
f891fd11b5 | ||
|
|
375235cc35 | ||
|
|
952b926f1e | ||
|
|
1ad42da3a3 | ||
|
|
d880c37ab1 | ||
|
|
0a9bcfa89d | ||
|
|
0fbd83f68a | ||
|
|
b383e88c74 | ||
|
|
3bccc557e2 | ||
|
|
76d01f8824 | ||
|
|
1a2cff6d14 | ||
|
|
5b8af31b0a | ||
|
|
0c06951a11 | ||
|
|
fa107d72bc | ||
|
|
b6858fcc5d | ||
|
|
b2698073d8 | ||
|
|
3410301a96 | ||
|
|
e7bc4c14e4 | ||
|
|
7cb5dd3638 | ||
|
|
3e9b0c11d8 | ||
|
|
47ee67868c | ||
|
|
3a1146ef37 | ||
|
|
6ce87101d3 | ||
|
|
0f89a54d5e | ||
|
|
891b2db577 | ||
|
|
c30c6e772a | ||
|
|
21d4ae5c2c | ||
|
|
9b7b4524e3 | ||
|
|
6b3dd0d1cb | ||
|
|
02a081b3e9 | ||
|
|
f719f4b515 | ||
|
|
238be9af6e | ||
|
|
3f280cb058 | ||
|
|
5b7bbe4533 | ||
|
|
5d11cac82c | ||
|
|
d46dcfbcbb |
@@ -1,4 +1,4 @@
|
||||
// Boost config.hpp configuration test program file ------------------------------//
|
||||
// Boost config.hpp configuration test program file -----------------------//
|
||||
|
||||
// (C) Copyright Boost.org 2000. Permission to copy, use, modify, sell and
|
||||
// distribute this software is granted provided this copyright notice appears
|
||||
@@ -11,10 +11,14 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cout;
|
||||
using std::hex;
|
||||
using std::dec;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
// boost compiler workaround defines
|
||||
|
||||
# ifdef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
cout << "BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS defined\n";
|
||||
# endif
|
||||
@@ -63,10 +67,37 @@ int main()
|
||||
cout << "BOOST_SYSTEM_HAS_STDINT_H defined\n";
|
||||
# endif
|
||||
|
||||
|
||||
// compilers
|
||||
|
||||
# ifdef __GNUC__
|
||||
cout << "__GNUC__ defined as " << __GNUC__ << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __GNUC_MINOR__
|
||||
cout << "__GNUC_MINOR__ defined as " << __GNUC_MINOR__ << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __EDG_VERSION__
|
||||
cout << "__EDG_VERSION__ defined as " << __EDG_VERSION__ << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __ICC
|
||||
cout << "__ICC defined as " << __ICC << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __ICL
|
||||
cout << "__ICL defined as " << __ICL << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __INTEL_COMPILER
|
||||
cout << "__INTEL_COMPILER defined as " << __INTEL_COMPILER << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __USLC__
|
||||
cout << "__USLC__ defined\n";
|
||||
# endif
|
||||
|
||||
# ifdef __BORLANDC__
|
||||
cout << "__BORLANDC__ defined as " << __BORLANDC__ << "\n";
|
||||
# endif
|
||||
@@ -79,6 +110,20 @@ int main()
|
||||
cout << "__SUNPRO_CC defined as " << __SUNPRO_CC << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __sgi
|
||||
cout << "__sgi is defined\n";
|
||||
# ifdef _COMPILER_VERSION
|
||||
cout << "_COMPILER_VERSION defined as " << _COMPILER_VERSION << "\n";
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef __DECCXX
|
||||
cout << "__DECCXX defined\n";
|
||||
# ifdef __DECCXX_VER
|
||||
cout << "__DECCXX_VER defined as " << __DECCXX_VER << "\n";
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef _MSC_VER
|
||||
cout << "_MSC_VER defined as " << _MSC_VER << "\n";
|
||||
# endif
|
||||
@@ -95,8 +140,28 @@ int main()
|
||||
cout << "BOOST_MSVC_STD_ITERATOR defined\n";
|
||||
# endif
|
||||
|
||||
|
||||
// libraries
|
||||
|
||||
# ifdef __SGI_STL_PORT
|
||||
cout << "__SGI_STL_PORT defined\n";
|
||||
cout << "__SGI_STL_PORT defined as 0x"
|
||||
<< hex << __SGI_STL_PORT << dec << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef __GLIBCPP__
|
||||
cout << "__GLIBCPP__ defined\n";
|
||||
# endif
|
||||
|
||||
# ifdef _GLIBCPP_VERSION
|
||||
cout << "_GLIBCPP_VERSION defined as " << _GLIBCPP_VERSION << "\n";
|
||||
# endif
|
||||
|
||||
# ifdef _GLIBCPP_USE_LONG_LONG
|
||||
cout << "_GLIBCPP_USE_LONG_LONG defined\n";
|
||||
# endif
|
||||
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
cout << "_GLIBCPP_USE_WCHAR_T defined\n";
|
||||
# endif
|
||||
|
||||
# ifdef __STL_NO_NAMESPACES
|
||||
@@ -111,5 +176,9 @@ int main()
|
||||
cout << "__STL_IMPORT_VENDOR_CSTD defined\n";
|
||||
# endif
|
||||
|
||||
# ifdef _RWSTD_VER
|
||||
cout << "_RWSTD_VER defined as " << _RWSTD_VER << "\n";
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,20 @@
|
||||
// http://www.boost.org/libs/config
|
||||
|
||||
// Revision History (excluding minor changes for specific compilers)
|
||||
// 29 Mar 01 BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS (Daryle Walker)
|
||||
// 16 Mar 01 Added BOOST_VERSION (Jens Maurer)
|
||||
// 06 Mar 01 Refactored EDG checks for Intel C++ (Dave Abrahams)
|
||||
// 04 Mar 01 Factored EDG checks, added BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
// for Intel C++ 5.0 (Dave Abrahams)
|
||||
// 17 Feb 01 BOOST_NO_CV_SPECIALIZATIONS
|
||||
// BOOST_NO_CV_VOID_SPECIALIZATIONS (John Maddock)
|
||||
// 11 Feb 01 Added BOOST_STATIC_CONSTANT (Dave Abrahams)
|
||||
// 20 Jan 01 BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS moved here from
|
||||
// cast.hpp. Added missing BOOST_NO_STRINGSTREAM which some
|
||||
// boost code seemed to depend on. (Dave Abrahams)
|
||||
// 13 Jan 01 SGI MIPSpro and Compaq Tru64 Unix compiler support added
|
||||
// (Jens Maurer)
|
||||
// 13 Jan 01 BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP (Jens Maurer)
|
||||
// 17 Nov 00 BOOST_NO_AUTO_PTR (John Maddock)
|
||||
// 4 Oct 00 BOOST_NO_STD_MIN_MAX (Jeremy Siek)
|
||||
// 29 Sep 00 BOOST_NO_INTEGRAL_INT64_T (Jens Maurer)
|
||||
@@ -45,6 +59,13 @@
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#define BOOST_CONFIG_HPP
|
||||
|
||||
#define BOOST_VERSION 102300
|
||||
|
||||
// BOOST_VERSION % 100 is the sub-minor version
|
||||
// BOOST_VERSION / 100 % 1000 is the minor version
|
||||
// BOOST_VERSION / 100000 is the major version
|
||||
|
||||
|
||||
// Conformance Flag Macros -------------------------------------------------//
|
||||
//
|
||||
// Conformance flag macros should identify the absence of C++ Standard
|
||||
@@ -53,10 +74,23 @@
|
||||
// burden where it should be, on non-conforming compilers. In the future,
|
||||
// hopefully, less rather than more conformance flags will have to be defined.
|
||||
|
||||
// BOOST_NO_CV_SPECIALIZATIONS: if template specialisations for cv-qualified types
|
||||
// conflict with a specialistaion for unqualififed type.
|
||||
|
||||
// BOOST_NO_CV_VOID_SPECIALIZATIONS: if template specialisations for cv-void types
|
||||
// conflict with a specialistaion for void.
|
||||
|
||||
// BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP: Compiler does not implement
|
||||
// argument-dependent lookup (also named Koenig lookup); see std::3.4.2
|
||||
// [basic.koenig.lookup]
|
||||
|
||||
// BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS: Template value
|
||||
// parameters cannot have a dependent type, for example
|
||||
// "template<class T, typename T::type value> class X { ... };"
|
||||
|
||||
// BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS: Can only use deduced
|
||||
// template arguments when calling function template instantiations.
|
||||
|
||||
// BOOST_NO_INCLASS_MEMBER_INITIALIZATION: Compiler violates std::9.4.2/4.
|
||||
|
||||
// BOOST_NO_INT64_T: <boost/cstdint.hpp> does not support 64-bit integer
|
||||
@@ -65,6 +99,9 @@
|
||||
// BOOST_NO_INTEGRAL_INT64_T: int64_t as defined by <boost/cstdint.hpp> is
|
||||
// not an integral type.
|
||||
|
||||
// BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS: constants such as
|
||||
// numeric_limits<T>::is_signed are not available for use at compile-time.
|
||||
|
||||
// BOOST_NO_MEMBER_TEMPLATES: Member template functions not fully supported.
|
||||
// Also see BOOST_MSVC6_MEMBER_TEMPLATES in the Compiler Control section below.
|
||||
|
||||
@@ -111,6 +148,23 @@
|
||||
// BOOST_NO_AUTO_PTR: If the compiler / library supplies non-standard or broken
|
||||
// std::auto_ptr.
|
||||
|
||||
// BOOST_WEAK_FUNCTION_TEMPLATE_ORDERING: The compiler does not perform
|
||||
// function template ordering or its function template ordering is incorrect.
|
||||
//
|
||||
// template<typename T> void f(T); // #1
|
||||
// template<typename T, typename U> void f(T (*)(U)); // #2
|
||||
// void bar(int);
|
||||
// f(&bar); // should choose #2.
|
||||
|
||||
// BOOST_NO_DEPENDENT_NESTED_DERIVATIONS: The compiler fails to compile
|
||||
// a nested class that has a dependent base class:
|
||||
// template<typename T>
|
||||
// struct foo : public T {
|
||||
// template<typename U>
|
||||
// struct bar : public T, public U {};
|
||||
// };
|
||||
|
||||
//
|
||||
// Compiler Control or Information Macros ----------------------------------//
|
||||
//
|
||||
// Compilers often supply features outside of the C++ Standard which need to be
|
||||
@@ -119,12 +173,19 @@
|
||||
|
||||
// BOOST_DECL: Certain compilers for Microsoft operating systems require
|
||||
// non-standard class and function decoration if dynamic load library linking
|
||||
// is desired. BOOST_DECL supplies that decoration, defaulting to a nul string
|
||||
// so that it is harmless when not required. Boost does not encourage the use
|
||||
// of BOOST_DECL - it is non-standard and to be avoided if practical to do so.
|
||||
|
||||
// BOOST_DECL_EXPORTS: User defined, BOOST_DECL_EXPORTS causes BOOST_DECL to
|
||||
// be defined as __declspec(dllexport) rather than __declspec(dllimport).
|
||||
// is desired. BOOST_DECL supplies that decoration. Boost does not require
|
||||
// use of BOOST_DECL - it is non-standard and to be avoided if practical to do
|
||||
// so. Even compilers requiring it for DLL's only require it in certain cases.
|
||||
//
|
||||
// BOOST_DECL_EXPORTS: User defined, usually via command line or IDE,
|
||||
// it causes BOOST_DECL to be defined as __declspec(dllexport).
|
||||
//
|
||||
// BOOST_DECL_IMPORTS: User defined, usually via command line or IDE,
|
||||
// it causes BOOST_DECL to be defined as __declspec(dllimport).
|
||||
//
|
||||
// If neither BOOST_DECL_EXPORTS nor BOOST_DECL_IMPORTS is defined, or if
|
||||
// the compiler does not require __declspec() decoration, BOOST_DECL is
|
||||
// defined as a null string.
|
||||
|
||||
// BOOST_MSVC6_MEMBER_TEMPLATES: Microsoft Visual C++ 6.0 has enough member
|
||||
// template idiosyncrasies (being polite) that BOOST_NO_MEMBER_TEMPLATES is
|
||||
@@ -150,6 +211,8 @@
|
||||
|
||||
// BOOST_NO_SLIST: The C++ implementation does not provide the slist class.
|
||||
|
||||
// BOOST_NO_STRINGSTREAM: The C++ implementation does not provide the <sstream> header.
|
||||
|
||||
// BOOST_NO_HASH: The C++ implementation does not provide the hash_set
|
||||
// or hash_map classes.
|
||||
|
||||
@@ -172,46 +235,29 @@
|
||||
// BOOST_NO_STD_MIN_MAX: The C++ standard library does not provide
|
||||
// the min() and max() template functions that should be in <algorithm>.
|
||||
|
||||
// Compilers are listed in alphabetic order (except VC++ last - see below)---//
|
||||
// Common compiler front-ends precede all compiler checks ------------------//
|
||||
|
||||
// GNU CC (also known as GCC and G++) --------------------------------------//
|
||||
|
||||
# if defined __GNUC__
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ == 91
|
||||
// egcs 1.1 won't parse smart_ptr.hpp without this:
|
||||
# define BOOST_NO_AUTO_PTR
|
||||
# endif
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
|
||||
# include <iterator> // not sure this is the right way to do this -JGS
|
||||
# if !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS
|
||||
# define BOOST_NO_STD_ITERATOR
|
||||
# define BOOST_NO_LIMITS
|
||||
# endif
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
# endif
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
// Edison Design Group front-ends
|
||||
# if defined(__EDG_VERSION__)
|
||||
# if __EDG_VERSION__ <= 241
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# endif
|
||||
|
||||
// Kai C++ ------------------------------------------------------------------//
|
||||
# endif
|
||||
|
||||
#elif defined __KCC
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
|
||||
// Greenhills C++ -----------------------------------------------------------//
|
||||
|
||||
#elif defined __ghs
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
// Compiler-specific checks -------------------------------------------------//
|
||||
// Compilers are listed in alphabetic order by vendor name
|
||||
// (except VC++ must be last - see below)
|
||||
|
||||
// Borland ------------------------------------------------------------------//
|
||||
|
||||
#elif defined __BORLANDC__
|
||||
#if defined __BORLANDC__
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
// pull in standard library version:
|
||||
# include <memory>
|
||||
# if __BORLANDC__ <= 0x0551
|
||||
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||
# endif
|
||||
@@ -225,19 +271,120 @@
|
||||
# endif
|
||||
# endif
|
||||
# if defined BOOST_DECL_EXPORTS
|
||||
# if defined BOOST_DECL_IMPORTS
|
||||
# error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS
|
||||
# endif
|
||||
# define BOOST_DECL __declspec(dllexport)
|
||||
# else
|
||||
# elif defined BOOST_DECL_IMPORTS
|
||||
# define BOOST_DECL __declspec(dllimport)
|
||||
# else
|
||||
# define BOOST_DECL
|
||||
# endif
|
||||
#if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551)
|
||||
// <climits> is partly broken, some macos define symbols that are really in
|
||||
// namespace std, so you end up having to use illegal constructs like
|
||||
// std::DBL_MAX, as a fix we'll just include float.h and have done with:
|
||||
#include <float.h>
|
||||
#endif
|
||||
# define BOOST_NO_CV_SPECIALIZATIONS
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
|
||||
// Comeau C++ ----------------------------------------------------------------//
|
||||
|
||||
# elif defined __COMO__
|
||||
# if __COMO_VERSION__ <= 4245
|
||||
# define BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS
|
||||
# endif
|
||||
|
||||
// Intel -------------------------------------------------------------------//
|
||||
// Compaq Tru64 Unix cxx ---------------------------------------------------
|
||||
|
||||
# elif defined __DECCXX
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
|
||||
// GNU CC (also known as GCC and G++) --------------------------------------//
|
||||
|
||||
# elif defined __GNUC__
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ == 91
|
||||
// egcs 1.1 won't parse smart_ptr.hpp without this:
|
||||
# define BOOST_NO_AUTO_PTR
|
||||
# endif
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 97
|
||||
# include <string> // not sure this is the right way to do this -JGS
|
||||
# if defined(__BASTRING__) && !defined(__GLIBCPP__) && !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS
|
||||
// this should only detect the stdlibc++ that ships with gcc, and
|
||||
// not any replacements that may be installed...
|
||||
# define BOOST_NO_STD_ITERATOR
|
||||
# define BOOST_NO_LIMITS
|
||||
# endif
|
||||
# if !defined(_CXXRT_STD) && !defined(__SGI_STL_OWN_IOSTREAMS)
|
||||
# define BOOST_NO_STRINGSTREAM
|
||||
# endif
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
# define BOOST_WEAK_FUNCTION_TEMPLATE_ORDERING
|
||||
# endif
|
||||
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
# endif
|
||||
# if __GNUC__ >= 3
|
||||
# include <iterator>
|
||||
# if defined(__GLIBCPP__)
|
||||
// The new GNU C++ library has slist, hash_map, hash_set headers
|
||||
// in <ext/*>, but client code assumes they're in <*> --- Jens M.
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// Greenhills C++ -----------------------------------------------------------//
|
||||
|
||||
#elif defined __ghs
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
|
||||
// HP aCC -------------------------------------------------------------------
|
||||
|
||||
# elif defined __HP_aCC
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
# define BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
// (support for HP aCC is not complete, see the regression test results)
|
||||
|
||||
// Intel on Linux -----------------------------------------------------------//
|
||||
|
||||
#elif defined __ICC
|
||||
# include <iterator>
|
||||
# ifdef _CPPLIB_VER
|
||||
// shipped with Dinkumware 3.10, which has a different hash_map
|
||||
# define BOOST_NO_HASH
|
||||
# endif
|
||||
|
||||
// Intel on Windows --------------------------------------------------------//
|
||||
|
||||
# elif defined __ICL
|
||||
# if __ICL <= 500
|
||||
// Intel C++ 5.0.1 uses EDG 2.45, but fails to activate Koenig lookup
|
||||
// in the frontend even in "strict" mode. (reported by Kirk Klobe)
|
||||
# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# endif
|
||||
# define BOOST_WEAK_FUNCTION_TEMPLATE_ORDERING
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T // tentative addition - required for VC6 compatibility? (added by JM 19 Feb 2001)
|
||||
# endif
|
||||
# include <iterator> // not sure this is the right way to do this -JGS
|
||||
# if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES)
|
||||
// a perfectly good implementation of std::iterator is supplied
|
||||
# elif defined(__SGI_STL_ITERATOR)
|
||||
# define BOOST_NO_STD_ITERATOR // No std::iterator in this case
|
||||
# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
|
||||
# // full dinkumware 3.06 and above
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
# if !_GLOBAL_USING // can be defined in yvals.h
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
# else // assume using dinkumware's STL that comes with VC++ 6.0
|
||||
# define BOOST_MSVC_STD_ITERATOR
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
@@ -249,36 +396,83 @@
|
||||
# define BOOST_NO_STD_MIN_MAX
|
||||
# endif
|
||||
|
||||
// Kai C++ ----------------------------------------------------------------
|
||||
|
||||
// Metrowerks CodeWarrior --------------------------------------------------//
|
||||
#elif defined __KCC
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
|
||||
# if __KCC_VERSION <= 4001
|
||||
// at least on Sun, the contents of <cwchar> is not in namespace std
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
|
||||
// Metrowerks CodeWarrior -------------------------------------------------//
|
||||
|
||||
# elif defined __MWERKS__
|
||||
# if __MWERKS__ <= 0x4000
|
||||
# if __MWERKS__ <= 0x2401 // 6.2
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_WEAK_FUNCTION_TEMPLATE_ORDERING
|
||||
# endif
|
||||
# if __MWERKS__ <= 0x2301
|
||||
# if __MWERKS__ <= 0x2301 // 5.3
|
||||
# define BOOST_NO_POINTER_TO_MEMBER_CONST
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
# define BOOST_NO_HASH
|
||||
# endif
|
||||
# if __MWERKS__ >= 0x2400
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
|
||||
# endif
|
||||
# if __MWERKS__ >= 0x2300
|
||||
# define BOOST_SYSTEM_HAS_STDINT_H
|
||||
# endif
|
||||
# if defined BOOST_DECL_EXPORTS
|
||||
# if defined BOOST_DECL_IMPORTS
|
||||
# error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS
|
||||
# endif
|
||||
# define BOOST_DECL __declspec(dllexport)
|
||||
# else
|
||||
# elif defined BOOST_DECL_IMPORTS
|
||||
# define BOOST_DECL __declspec(dllimport)
|
||||
# else
|
||||
# define BOOST_DECL
|
||||
# endif
|
||||
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
|
||||
// SGI MIPSpro C++ ---------------------------------------------------------//
|
||||
|
||||
// Sun Workshop Compiler C++ ------------------------------------------------//
|
||||
# elif defined __sgi
|
||||
// This is a generic STLport condition and could be moved elsewhere.
|
||||
# include <iterator>
|
||||
# if defined(__SGI_STL_PORT) && !defined(__STL_MEMBER_TEMPLATE_CLASSES) && !defined(_STLP_MEMBER_TEMPLATE_CLASSES)
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
# endif
|
||||
|
||||
// Sun Workshop Compiler C++ -----------------------------------------------//
|
||||
|
||||
# elif defined __SUNPRO_CC
|
||||
# if __SUNPRO_CC <= 0x520
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
|
||||
// although sunpro 5.1 supports the syntax for
|
||||
// inline initialization it often gets the value
|
||||
// wrong, especially where the value is computed
|
||||
// from other constants (J Maddock 6th May 2001)
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
|
||||
// although sunpro 5.1 supports the syntax for
|
||||
// partial specialization, it often seems to
|
||||
// bind to the wrong specialization. Better
|
||||
// to disable it until suppport becomes more stable
|
||||
// (J Maddock 6th May 2001).
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# endif
|
||||
# if __SUNPRO_CC <= 0x500
|
||||
# define BOOST_NO_MEMBER_TEMPLATES
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# endif
|
||||
|
||||
// Microsoft Visual C++ (excluding Intel/EDG front end) --------------------//
|
||||
// Microsoft Visual C++ (excluding Intel/EDG front end) --------------------
|
||||
//
|
||||
// Must remain the last #elif since some other vendors (Metrowerks, for
|
||||
// example) also #define _MSC_VER
|
||||
@@ -293,6 +487,8 @@
|
||||
# if _MSC_VER <= 1200 // 1200 == VC++ 6.0
|
||||
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
|
||||
# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
|
||||
|
||||
# define BOOST_NO_INTEGRAL_INT64_T
|
||||
# define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
@@ -306,14 +502,25 @@
|
||||
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
|
||||
|
||||
# define BOOST_WEAK_FUNCTION_TEMPLATE_ORDERING
|
||||
# include <iterator> // not sure this is the right way to do this -JGS
|
||||
# if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES)
|
||||
// a perfectly good implementation of std::iterator is supplied
|
||||
// A conforming allocator is supplied, but the compiler cannot cope
|
||||
// when using "rebind". (Douglas Gregor)
|
||||
# define BOOST_NO_STD_ALLOCATOR
|
||||
# elif defined(__SGI_STL_ITERATOR)
|
||||
# define BOOST_NO_STD_ITERATOR // No std::iterator in this case
|
||||
# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
|
||||
// full dinkumware 3.06 and above
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
# ifndef _GLOBAL_USING // can be defined in yvals.h
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
# define BOOST_MSVC_STD_ITERATOR
|
||||
# else
|
||||
# define BOOST_MSVC_STD_ITERATOR 1
|
||||
# define BOOST_MSVC_STD_ITERATOR
|
||||
# define BOOST_NO_SLIST
|
||||
# define BOOST_NO_HASH
|
||||
# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
@@ -331,6 +538,7 @@
|
||||
# endif
|
||||
# endif
|
||||
# define BOOST_NO_STD_ITERATOR_TRAITS
|
||||
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
|
||||
|
||||
// Make sure at least one standard library header is included so that library
|
||||
@@ -340,16 +548,21 @@
|
||||
|
||||
// Determine if the standard library implementation is already pulling names
|
||||
// into std. STLport defines the following if so. (Ed Brey 5 Jun 00)
|
||||
# ifndef __STL_IMPORT_VENDOR_CSTD
|
||||
# if !defined( __STL_IMPORT_VENDOR_CSTD ) || defined( __STL_NO_CSTD_FUNCTION_IMPORTS )
|
||||
# define BOOST_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
# if defined BOOST_DECL_EXPORTS
|
||||
# if defined BOOST_DECL_IMPORTS
|
||||
# error Not valid to define both BOOST_DECL_EXPORTS and BOOST_DECL_IMPORTS
|
||||
# endif
|
||||
# define BOOST_DECL __declspec(dllexport)
|
||||
# else
|
||||
# elif defined BOOST_DECL_IMPORTS
|
||||
# define BOOST_DECL __declspec(dllimport)
|
||||
# else
|
||||
# define BOOST_DECL
|
||||
# endif
|
||||
|
||||
# endif // Microsoft (excluding Intel/EDG frontend)
|
||||
@@ -360,6 +573,22 @@
|
||||
|
||||
// end of compiler specific portion ----------------------------------------//
|
||||
|
||||
#if defined(BOOST_NO_LIMITS) || (defined(_RWSTD_VER) && defined(__BORLANDC__) && _RWSTD_VER < 0x020300) || (defined(__SGI_STL_PORT) && __SGI_STL_PORT <= 0x410 && defined(__STL_STATIC_CONST_INIT_BUG))
|
||||
// STLPort 4.0 doesn't define the static constants in numeric_limits<> so that they
|
||||
// can be used at compile time if the compiler bug indicated by
|
||||
// __STL_STATIC_CONST_INIT_BUG is present.
|
||||
|
||||
// Rogue wave STL (C++ Builder) also has broken numeric_limits
|
||||
// with default template defining members out of line.
|
||||
// However, Compaq C++ also uses RogueWave (version 0x0203) and it's ok.
|
||||
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
#endif
|
||||
|
||||
#if defined(__hpux)
|
||||
// HP-UX has a nice stdint.h in a different location, see boost/cstdint.hpp
|
||||
# define BOOST_SYSTEM_HAS_STDINT_H
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_STD_EXTENSION_NAMESPACE
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE std
|
||||
#endif
|
||||
@@ -407,8 +636,22 @@ namespace std {
|
||||
}
|
||||
#endif
|
||||
|
||||
// BOOST_STATIC_CONSTANT workaround --------------------------------------- //
|
||||
// On compilers which don't allow in-class initialization of static integral
|
||||
// constant members, we must use enums as a workaround if we want the constants
|
||||
// to be available at compile-time. This macro gives us a convenient way to
|
||||
// declare such constants.
|
||||
#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
|
||||
#else
|
||||
# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONFIG_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
443
include/boost/detail/limits.hpp
Normal file
443
include/boost/detail/limits.hpp
Normal file
@@ -0,0 +1,443 @@
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/* NOTE: This is not portable code. Parts of numeric_limits<> are
|
||||
* inherently machine-dependent, and this file is written for the MIPS
|
||||
* architecture and the SGI MIPSpro C++ compiler. Parts of it (in
|
||||
* particular, some of the characteristics of floating-point types)
|
||||
* are almost certainly incorrect for any other platform.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Revision history:
|
||||
* 13 Apr 2001:
|
||||
* Added powerpc to the big endian family. (Jeremy Siek)
|
||||
* 5 Apr 2001:
|
||||
* Added sparc (big endian) processor support (John Maddock).
|
||||
* Initial sub:
|
||||
* Modified by Jens Maurer for gcc 2.95 on x86.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SGI_CPP_LIMITS
|
||||
#define BOOST_SGI_CPP_LIMITS
|
||||
|
||||
#include <climits>
|
||||
#include <cfloat>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(__sparc) || defined(__sparc__) || defined(__powerpc__) || defined(__hppa)
|
||||
#define BOOST_BIG_ENDIAN
|
||||
#elif !defined(__i386__)
|
||||
#error The file boost/detail/limits.hpp needs to be set up for your CPU type.
|
||||
#endif
|
||||
|
||||
namespace std {
|
||||
|
||||
enum float_round_style {
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
enum float_denorm_style {
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
// The C++ standard (section 18.2.1) requires that some of the members of
|
||||
// numeric_limits be static const data members that are given constant-
|
||||
// initializers within the class declaration. On compilers where the
|
||||
// BOOST_NO_INCLASS_MEMBER_INITIALIZATION macro is defined, it is impossible to write
|
||||
// a standard-conforming numeric_limits class.
|
||||
//
|
||||
// There are two possible workarounds: either initialize the data
|
||||
// members outside the class, or change them from data members to
|
||||
// enums. Neither workaround is satisfactory: the former makes it
|
||||
// impossible to use the data members in constant-expressions, and the
|
||||
// latter means they have the wrong type and that it is impossible to
|
||||
// take their addresses. We choose the former workaround.
|
||||
|
||||
#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \
|
||||
enum { __mem_name = __mem_value }
|
||||
#else /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */
|
||||
# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \
|
||||
static const __mem_type __mem_name = __mem_value
|
||||
#endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */
|
||||
|
||||
// Base class for all specializations of numeric_limits.
|
||||
|
||||
template <class __number>
|
||||
class _Numeric_limits_base {
|
||||
public:
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false);
|
||||
|
||||
static __number min() throw() { return __number(); }
|
||||
static __number max() throw() { return __number(); }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 0);
|
||||
|
||||
static __number epsilon() throw() { return __number(); }
|
||||
static __number round_error() throw() { return __number(); }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
|
||||
has_denorm,
|
||||
denorm_absent);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false);
|
||||
|
||||
static __number infinity() throw() { return __number(); }
|
||||
static __number quiet_NaN() throw() { return __number(); }
|
||||
static __number signaling_NaN() throw() { return __number(); }
|
||||
static __number denorm_min() throw() { return __number(); }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style,
|
||||
round_style,
|
||||
round_toward_zero);
|
||||
};
|
||||
|
||||
// Base class for integers.
|
||||
|
||||
template <class _Int,
|
||||
_Int __imin,
|
||||
_Int __imax,
|
||||
int __idigits = -1>
|
||||
class _Integer_limits : public _Numeric_limits_base<_Int>
|
||||
{
|
||||
public:
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
|
||||
|
||||
static _Int min() throw() { return __imin; }
|
||||
static _Int max() throw() { return __imax; }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int,
|
||||
digits,
|
||||
(__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT)
|
||||
- (__imin == 0 ? 0 : 1)
|
||||
: __idigits);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000);
|
||||
// log 2 = 0.301029995664...
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, true);
|
||||
};
|
||||
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
|
||||
template<class Number, unsigned int Word>
|
||||
struct float_helper{
|
||||
static Number get_word() throw() {
|
||||
// sizeof(long double) == 16
|
||||
const unsigned int _S_word[4] = { Word, 0, 0, 0 };
|
||||
return *reinterpret_cast<const Number*>(&_S_word);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<class Number, unsigned int Word>
|
||||
struct float_helper{
|
||||
static Number get_word() throw() {
|
||||
// sizeof(long double) == 12, but only 10 bytes significant
|
||||
const unsigned int _S_word[4] = { 0, 0, 0, Word };
|
||||
return *reinterpret_cast<const Number*>(
|
||||
reinterpret_cast<const char *>(&_S_word)+16-
|
||||
(sizeof(Number) == 12 ? 10 : sizeof(Number)));
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Base class for floating-point numbers.
|
||||
template <class __number,
|
||||
int __Digits, int __Digits10,
|
||||
int __MinExp, int __MaxExp,
|
||||
int __MinExp10, int __MaxExp10,
|
||||
unsigned int __InfinityWord,
|
||||
unsigned int __QNaNWord, unsigned int __SNaNWord,
|
||||
bool __IsIEC559,
|
||||
float_round_style __RoundStyle>
|
||||
class _Floating_limits : public _Numeric_limits_base<__number>
|
||||
{
|
||||
public:
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
|
||||
has_denorm,
|
||||
denorm_indeterminate);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false);
|
||||
|
||||
|
||||
static __number infinity() throw() {
|
||||
return float_helper<__number, __InfinityWord>::get_word();
|
||||
}
|
||||
static __number quiet_NaN() throw() {
|
||||
return float_helper<__number,__QNaNWord>::get_word();
|
||||
}
|
||||
static __number signaling_NaN() throw() {
|
||||
return float_helper<__number,__SNaNWord>::get_word();
|
||||
}
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false /* was: true */ );
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle);
|
||||
};
|
||||
|
||||
// Class numeric_limits
|
||||
|
||||
// The unspecialized class.
|
||||
|
||||
template<class T>
|
||||
class numeric_limits : public _Numeric_limits_base<T> {};
|
||||
|
||||
// Specializations for all built-in integral types.
|
||||
|
||||
template<>
|
||||
class numeric_limits<bool>
|
||||
: public _Integer_limits<bool, false, true, 0>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<char>
|
||||
: public _Integer_limits<char, CHAR_MIN, CHAR_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<signed char>
|
||||
: public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned char>
|
||||
: public _Integer_limits<unsigned char, 0, UCHAR_MAX>
|
||||
{};
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
#if !defined(WCHAR_MAX) || !defined(WCHAR_MIN)
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__)
|
||||
template<>
|
||||
class numeric_limits<wchar_t>
|
||||
: public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
|
||||
{};
|
||||
#else
|
||||
template<>
|
||||
class numeric_limits<wchar_t>
|
||||
: public _Integer_limits<wchar_t, 0, USHRT_MAX>
|
||||
{};
|
||||
#endif
|
||||
#else
|
||||
template<>
|
||||
class numeric_limits<wchar_t>
|
||||
: public _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX>
|
||||
{};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template<>
|
||||
class numeric_limits<short>
|
||||
: public _Integer_limits<short, SHRT_MIN, SHRT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned short>
|
||||
: public _Integer_limits<unsigned short, 0, USHRT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<int>
|
||||
: public _Integer_limits<int, INT_MIN, INT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned int>
|
||||
: public _Integer_limits<unsigned int, 0, UINT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<long>
|
||||
: public _Integer_limits<long, LONG_MIN, LONG_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned long>
|
||||
: public _Integer_limits<unsigned long, 0, ULONG_MAX>
|
||||
{};
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
// Some compilers have long long, but don't define the
|
||||
// LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This
|
||||
// assumes that long long is 64 bits.
|
||||
#if !defined(LONGLONG_MIN) && !defined(LONGLONG_MAX) \
|
||||
&& !defined(ULONGLONG_MAX)
|
||||
|
||||
#define ULONGLONG_MAX 0xffffffffffffffffLLU
|
||||
#define LONGLONG_MAX 0x7fffffffffffffffLL
|
||||
#define LONGLONG_MIN (-LONGLONG_MAX - 1)
|
||||
|
||||
#endif
|
||||
|
||||
template<>
|
||||
class numeric_limits<long long>
|
||||
: public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned long long>
|
||||
: public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX>
|
||||
{};
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
// Specializations for all built-in floating-point type.
|
||||
|
||||
template<> class numeric_limits<float>
|
||||
: public _Floating_limits<float,
|
||||
FLT_MANT_DIG, // Binary digits of precision
|
||||
FLT_DIG, // Decimal digits of precision
|
||||
FLT_MIN_EXP, // Minimum exponent
|
||||
FLT_MAX_EXP, // Maximum exponent
|
||||
FLT_MIN_10_EXP, // Minimum base 10 exponent
|
||||
FLT_MAX_10_EXP, // Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7f80 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7f81 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7fc1 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7f800000u, // Last word of +infinity
|
||||
0x7f810000u, // Last word of quiet NaN
|
||||
0x7fc10000u, // Last word of signaling NaN
|
||||
#endif
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static float min() throw() { return FLT_MIN; }
|
||||
static float denorm_min() throw() { return FLT_MIN; }
|
||||
static float max() throw() { return FLT_MAX; }
|
||||
static float epsilon() throw() { return FLT_EPSILON; }
|
||||
static float round_error() throw() { return 0.5f; } // Units: ulps.
|
||||
};
|
||||
|
||||
template<> class numeric_limits<double>
|
||||
: public _Floating_limits<double,
|
||||
DBL_MANT_DIG, // Binary digits of precision
|
||||
DBL_DIG, // Decimal digits of precision
|
||||
DBL_MIN_EXP, // Minimum exponent
|
||||
DBL_MAX_EXP, // Maximum exponent
|
||||
DBL_MIN_10_EXP, // Minimum base 10 exponent
|
||||
DBL_MAX_10_EXP, // Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7ff00000u, // Last word of +infinity
|
||||
0x7ff10000u, // Last word of quiet NaN
|
||||
0x7ff90000u, // Last word of signaling NaN
|
||||
#endif
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static double min() throw() { return DBL_MIN; }
|
||||
static double denorm_min() throw() { return DBL_MIN; }
|
||||
static double max() throw() { return DBL_MAX; }
|
||||
static double epsilon() throw() { return DBL_EPSILON; }
|
||||
static double round_error() throw() { return 0.5; } // Units: ulps.
|
||||
};
|
||||
|
||||
template<> class numeric_limits<long double>
|
||||
: public _Floating_limits<long double,
|
||||
LDBL_MANT_DIG, // Binary digits of precision
|
||||
LDBL_DIG, // Decimal digits of precision
|
||||
LDBL_MIN_EXP, // Minimum exponent
|
||||
LDBL_MAX_EXP, // Maximum exponent
|
||||
LDBL_MIN_10_EXP,// Minimum base 10 exponent
|
||||
LDBL_MAX_10_EXP,// Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7fff8000u, // Last word of +infinity
|
||||
0x7fffc000u, // Last word of quiet NaN
|
||||
0x7fff9000u, // Last word of signaling NaN
|
||||
#endif
|
||||
false, // Doesn't conform to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static long double min() throw() { return LDBL_MIN; }
|
||||
static long double denorm_min() throw() { return LDBL_MIN; }
|
||||
static long double max() throw() { return LDBL_MAX; }
|
||||
static long double epsilon() throw() { return LDBL_EPSILON; }
|
||||
static long double round_error() throw() { return 4; } // Units: ulps.
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif /* BOOST_SGI_CPP_LIMITS */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
|
||||
|
||||
|
||||
20
include/boost/limits.hpp
Normal file
20
include/boost/limits.hpp
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
// (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.
|
||||
//
|
||||
// use this header as a workaround for missing <limits>
|
||||
|
||||
#ifndef BOOST_LIMITS
|
||||
#define BOOST_LIMITS
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_LIMITS
|
||||
#include <boost/detail/limits.hpp>
|
||||
#else
|
||||
#include <limits>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,407 +0,0 @@
|
||||
/** -*- C++ -*-
|
||||
** KAI C++ Compiler
|
||||
**
|
||||
** Copyright (C) 1996-1997, Kuck & Associates, Inc. All rights reserved.
|
||||
** This is an almost complete rewrite of Modena version.
|
||||
**/
|
||||
/**
|
||||
** Lib++ : The Modena C++ Standard Library,
|
||||
** Version 2.4, August 27th 1997
|
||||
**
|
||||
** Copyright (c) 1994-1997 Modena Software Inc.
|
||||
**/
|
||||
#ifndef BOOST_GRAPH_DETAIL_LIMITS_HPP
|
||||
#define BOOST_GRAPH_DETAIL_LIMITS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_LIMITS
|
||||
|
||||
#define MSIPL_THROW
|
||||
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
|
||||
namespace std {
|
||||
|
||||
enum float_round_style {
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class numeric_limits {
|
||||
public:
|
||||
static const bool is_specialized = false;
|
||||
static T min() throw() {return T();}
|
||||
static T max() throw() {return T();}
|
||||
static const int digits = 0;
|
||||
static const int digits10 = 0;
|
||||
static const bool is_signed = false;
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = false;
|
||||
static const int radix = 0;
|
||||
static T epsilon() throw() {return T();}
|
||||
static T round_error() throw() {return T();}
|
||||
|
||||
static const int min_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
static const int max_exponent = 0;
|
||||
static const int max_exponent10 = 0;
|
||||
|
||||
static const bool has_infinity = false;
|
||||
static const bool has_quiet_NaN = false;
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const bool has_denorm = false;
|
||||
static const bool has_denorm_loss = false;
|
||||
|
||||
// Sept. 1996 draft is vague on how these can be guaranteed to return
|
||||
// value without throwing an exception.
|
||||
static T infinity() throw() {return T();};
|
||||
static T quiet_NaN() throw() {return T();}
|
||||
static T signaling_NaN() throw() {return T();}
|
||||
static T denorm_min() throw() {return T();}
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = false;
|
||||
static const bool is_modulo = false;
|
||||
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
};
|
||||
template<class T> const bool numeric_limits<T>::is_specialized;
|
||||
template<class T> const int numeric_limits<T>::digits;
|
||||
template<class T> const int numeric_limits<T>::digits10;
|
||||
template<class T> const bool numeric_limits<T>::is_signed;
|
||||
template<class T> const bool numeric_limits<T>::is_integer;
|
||||
template<class T> const bool numeric_limits<T>::is_exact;
|
||||
template<class T> const int numeric_limits<T>::radix;
|
||||
template<class T> const int numeric_limits<T>::min_exponent;
|
||||
template<class T> const int numeric_limits<T>::min_exponent10;
|
||||
template<class T> const int numeric_limits<T>::max_exponent;
|
||||
template<class T> const int numeric_limits<T>::max_exponent10;
|
||||
template<class T> const bool numeric_limits<T>::has_infinity;
|
||||
template<class T> const bool numeric_limits<T>::has_quiet_NaN;
|
||||
template<class T> const bool numeric_limits<T>::has_signaling_NaN;
|
||||
template<class T> const bool numeric_limits<T>::has_denorm;
|
||||
template<class T> const bool numeric_limits<T>::has_denorm_loss;
|
||||
template<class T> const bool numeric_limits<T>::is_iec559;
|
||||
template<class T> const bool numeric_limits<T>::is_bounded;
|
||||
template<class T> const bool numeric_limits<T>::is_modulo;
|
||||
template<class T> const bool numeric_limits<T>::traps;
|
||||
template<class T> const bool numeric_limits<T>::tinyness_before;
|
||||
template<class T> const float_round_style numeric_limits<T>::round_style;
|
||||
|
||||
// The specializations for floating-point types use the following macro
|
||||
// to factor out commonality. They presume IEEE arithmetic.
|
||||
#define __KAI_NUMERIC_LIMITS_FLOAT(T) \
|
||||
static const bool is_specialized = true; \
|
||||
static const int radix = 2; \
|
||||
\
|
||||
static const bool is_signed = true; \
|
||||
static const bool is_integer = false; \
|
||||
static const bool is_exact = false; \
|
||||
\
|
||||
static const bool has_infinity = true; \
|
||||
static const bool has_quiet_NaN = true; \
|
||||
static const bool has_signaling_NaN = true; \
|
||||
static const bool has_denorm = false; \
|
||||
static const bool has_denorm_loss = false; \
|
||||
\
|
||||
static const bool is_iec559 = sizeof(T)<=8; \
|
||||
static const bool is_bounded = true; \
|
||||
static const bool is_modulo = false; \
|
||||
static const bool traps = true; \
|
||||
static const bool tinyness_before = true; \
|
||||
\
|
||||
static T round_error () MSIPL_THROW { return (T)0.5F; } \
|
||||
static const float_round_style round_style = round_to_nearest; \
|
||||
static T infinity () MSIPL_THROW {return *(T*)(void*)data.value[0];}\
|
||||
static T quiet_NaN () MSIPL_THROW {return *(T*)(void*)data.value[1];}\
|
||||
static T signaling_NaN () MSIPL_THROW {return *(T*)(void*)data.value[2];}\
|
||||
private: \
|
||||
static const struct data_t { \
|
||||
T align; \
|
||||
int value[3][sizeof(T)/sizeof(int)]; \
|
||||
} data; \
|
||||
public: \
|
||||
|
||||
template<>
|
||||
class numeric_limits <float> {
|
||||
public:
|
||||
static const int digits = FLT_MANT_DIG;
|
||||
static const int digits10 = FLT_DIG;
|
||||
static const int min_exponent = FLT_MIN_EXP;
|
||||
static const int max_exponent = FLT_MAX_EXP;
|
||||
static const int min_exponent10 = FLT_MIN_10_EXP;
|
||||
static const int max_exponent10 = FLT_MAX_10_EXP;
|
||||
|
||||
__KAI_NUMERIC_LIMITS_FLOAT(float)
|
||||
|
||||
static float min () MSIPL_THROW { return FLT_MIN; }
|
||||
static float max () MSIPL_THROW { return FLT_MAX; }
|
||||
static float epsilon () MSIPL_THROW { return FLT_EPSILON; }
|
||||
static float denorm_min () MSIPL_THROW { return FLT_MIN; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <double> {
|
||||
public:
|
||||
static const int digits = DBL_MANT_DIG;
|
||||
static const int digits10 = DBL_DIG;
|
||||
static const int min_exponent = DBL_MIN_EXP;
|
||||
static const int max_exponent = DBL_MAX_EXP;
|
||||
static const int min_exponent10 = DBL_MIN_10_EXP;
|
||||
static const int max_exponent10 = DBL_MAX_10_EXP;
|
||||
|
||||
__KAI_NUMERIC_LIMITS_FLOAT(double)
|
||||
|
||||
static double min () MSIPL_THROW { return DBL_MIN; }
|
||||
static double max () MSIPL_THROW { return DBL_MAX; }
|
||||
static double epsilon () MSIPL_THROW { return DBL_EPSILON; }
|
||||
static double denorm_min () MSIPL_THROW { return min (); }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <long double> {
|
||||
public:
|
||||
static const int digits = LDBL_MANT_DIG;
|
||||
static const int digits10 = LDBL_DIG;
|
||||
static const int min_exponent = LDBL_MIN_EXP;
|
||||
static const int max_exponent = LDBL_MAX_EXP;
|
||||
static const int min_exponent10 = LDBL_MIN_10_EXP;
|
||||
static const int max_exponent10 = LDBL_MAX_10_EXP;
|
||||
|
||||
__KAI_NUMERIC_LIMITS_FLOAT(long double)
|
||||
|
||||
static long double min () MSIPL_THROW { return LDBL_MIN; }
|
||||
static long double max () MSIPL_THROW { return LDBL_MAX; }
|
||||
static long double epsilon () MSIPL_THROW { return LDBL_EPSILON; }
|
||||
static long double denorm_min () MSIPL_THROW { return min (); }
|
||||
};
|
||||
|
||||
// The specializations for integral types use three macros to factor out
|
||||
// commonality.
|
||||
//
|
||||
// __KAI_NUMERIC_LIMITS_INTEGRAL declares members of numeric_limits<T>
|
||||
// whose value does not depend on the signdness of T.
|
||||
//
|
||||
// __KAI_NUMERIC_LIMITS_SIGNED(T) declares members dependent on
|
||||
// knowing that T is signed.
|
||||
//
|
||||
// __KAI_NUMERIC_LIMITS_UNSIGNED(T) declares members dependent on
|
||||
// knowing that T is unsigned.
|
||||
//
|
||||
// We could have been real cutesy and come up with definitions that would
|
||||
// work for both signed and unsigned types, but doing so does not seem
|
||||
// to be worth the additional obfuscation and overhead for constant folding.
|
||||
//
|
||||
// The definitions are not intended to be universally portable.
|
||||
// They are designed with KAI C++ targets in mind. -ADR
|
||||
|
||||
#define __KAI_NUMERIC_LIMITS_INTEGRAL(T) \
|
||||
static const bool is_specialized = true; \
|
||||
\
|
||||
static const int radix = 2; \
|
||||
static const int min_exponent = 0; \
|
||||
static const int max_exponent = 0; \
|
||||
static const int min_exponent10 = 0; \
|
||||
static const int max_exponent10 = 0; \
|
||||
\
|
||||
static const bool is_integer = true; \
|
||||
static const bool is_exact = true; \
|
||||
\
|
||||
static const bool has_infinity = false; \
|
||||
static const bool has_quiet_NaN = false; \
|
||||
static const bool has_signaling_NaN = false; \
|
||||
static const bool has_denorm = false; \
|
||||
static const bool has_denorm_loss = false; \
|
||||
\
|
||||
static const bool is_iec559 = false; \
|
||||
static const bool is_bounded = true; \
|
||||
static const bool is_modulo = true; \
|
||||
static const bool traps = false; \
|
||||
static const bool tinyness_before = false; \
|
||||
\
|
||||
static T infinity () MSIPL_THROW { return 0; } \
|
||||
static T quiet_NaN () MSIPL_THROW { return 0; } \
|
||||
static T signaling_NaN () MSIPL_THROW { return 0; } \
|
||||
static T epsilon () MSIPL_THROW { return 1; } \
|
||||
static T denorm_min () MSIPL_THROW { return min (); } \
|
||||
static T round_error () MSIPL_THROW { return 0; } \
|
||||
\
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
|
||||
#define __KAI_NUMERIC_LIMITS_SIGNED(T) \
|
||||
static const int digits = 8*sizeof(T)-1; \
|
||||
/* Following presumes 8, 16, 32, or 64-bit T. */ \
|
||||
static const int digits10 = 7*sizeof(T)/3; \
|
||||
static const bool is_signed = true;
|
||||
|
||||
#define __KAI_NUMERIC_LIMITS_UNSIGNED(T) \
|
||||
static const int digits = 8*sizeof(T); \
|
||||
/* Following presumes 8, 16, 32, or 64-bit T. */ \
|
||||
static const int digits10 = 12*sizeof(T)/5; \
|
||||
static const bool is_signed = false;
|
||||
|
||||
template<>
|
||||
class numeric_limits <int> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(int)
|
||||
__KAI_NUMERIC_LIMITS_SIGNED(int)
|
||||
static int min() MSIPL_THROW { return INT_MIN; }
|
||||
static int max() MSIPL_THROW { return INT_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <unsigned int> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(unsigned int)
|
||||
__KAI_NUMERIC_LIMITS_UNSIGNED(unsigned int)
|
||||
static unsigned int min() MSIPL_THROW { return 0; }
|
||||
static unsigned int max() MSIPL_THROW { return UINT_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <long> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(long)
|
||||
__KAI_NUMERIC_LIMITS_SIGNED(long)
|
||||
static long min() MSIPL_THROW { return LONG_MIN; }
|
||||
static long max() MSIPL_THROW { return LONG_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <unsigned long> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(unsigned long)
|
||||
__KAI_NUMERIC_LIMITS_UNSIGNED(unsigned long)
|
||||
static unsigned long min() MSIPL_THROW { return 0; }
|
||||
static unsigned long max() MSIPL_THROW { return ULONG_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <short> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(short)
|
||||
__KAI_NUMERIC_LIMITS_SIGNED(short)
|
||||
static short min () MSIPL_THROW { return SHRT_MIN; }
|
||||
static short max () MSIPL_THROW { return SHRT_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <unsigned short> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(unsigned short)
|
||||
__KAI_NUMERIC_LIMITS_UNSIGNED(unsigned short)
|
||||
static unsigned short min () MSIPL_THROW { return 0; }
|
||||
static unsigned short max () MSIPL_THROW { return USHRT_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <char> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(char)
|
||||
static const int digits = CHAR_MIN<0 ? 7 : 8;
|
||||
static const int digits10 = 2;
|
||||
static const bool is_signed = CHAR_MIN<0;
|
||||
static char min () MSIPL_THROW { return CHAR_MIN; }
|
||||
static char max () MSIPL_THROW { return CHAR_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <signed char> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(signed char)
|
||||
__KAI_NUMERIC_LIMITS_SIGNED(signed char)
|
||||
static signed char min () MSIPL_THROW { return SCHAR_MIN; }
|
||||
static signed char max () MSIPL_THROW { return SCHAR_MAX; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class numeric_limits <unsigned char> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(unsigned char)
|
||||
__KAI_NUMERIC_LIMITS_UNSIGNED(unsigned char)
|
||||
static unsigned char min () MSIPL_THROW { return 0; }
|
||||
static unsigned char max () MSIPL_THROW { return UCHAR_MAX; }
|
||||
};
|
||||
|
||||
#if 0
|
||||
#ifdef MSIPL_WCHART
|
||||
|
||||
template<>
|
||||
class numeric_limits <wchar_t> {
|
||||
public:
|
||||
__KAI_NUMERIC_LIMITS_INTEGRAL(wchar_t)
|
||||
static const bool is_signed = (wchar_t)-1<0;
|
||||
static const int digits = 8*sizeof(wchar_t) - is_signed;
|
||||
// Following assumes that wchar_t is 8, 16, or 32-bit,
|
||||
// either signed or unsigned.
|
||||
static const int digits10 = 7*sizeof(T)/3;
|
||||
static char min () MSIPL_THROW { return CHAR_MIN; }
|
||||
static char max () MSIPL_THROW { return CHAR_MAX; }
|
||||
};
|
||||
|
||||
#endif /* MSIPL_WCHART */
|
||||
|
||||
#ifdef _BOOL
|
||||
template<>
|
||||
class numeric_limits <bool> {
|
||||
public:
|
||||
static const bool is_specialized = true;
|
||||
|
||||
static const int radix = 2;
|
||||
static const int min_exponent = 0;
|
||||
static const int max_exponent = 0;
|
||||
static const int min_exponent10 = 0;
|
||||
static const int max_exponent10 = 0;
|
||||
|
||||
static const bool is_integer = false;
|
||||
static const bool is_exact = true;
|
||||
|
||||
static const bool has_infinity = false;
|
||||
static const bool has_quiet_NaN = false;
|
||||
static const bool has_signaling_NaN = false;
|
||||
static const bool has_denorm = false;
|
||||
static const bool has_denorm_loss = false;
|
||||
|
||||
static const bool is_iec559 = false;
|
||||
static const bool is_bounded = true;
|
||||
static const bool is_modulo = false;
|
||||
static const bool traps = false;
|
||||
static const bool tinyness_before = false;
|
||||
|
||||
static bool infinity () MSIPL_THROW { return false; }
|
||||
static bool quiet_NaN () MSIPL_THROW { return false; }
|
||||
static bool signaling_NaN () MSIPL_THROW { return false; }
|
||||
static bool epsilon () MSIPL_THROW { return false; }
|
||||
static bool denorm_min () MSIPL_THROW { return min (); }
|
||||
static bool round_error () MSIPL_THROW { return false; }
|
||||
|
||||
static const float_round_style round_style = round_toward_zero;
|
||||
|
||||
static const int digits = 1;
|
||||
static const int digits10 = 0;
|
||||
static const bool is_signed = false;
|
||||
|
||||
static bool min () MSIPL_THROW { return false; }
|
||||
static bool max () MSIPL_THROW { return true; }
|
||||
};
|
||||
#endif /* _BOOL */
|
||||
#endif
|
||||
|
||||
} /* namespace std */
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#include <limits>
|
||||
|
||||
#endif /* BOOST_GRAPH_DETAIL_HAVE_LIMITS */
|
||||
|
||||
#endif /* BOOST_GRAPH_DETAIL_LIMIT_H */
|
||||
@@ -79,8 +79,10 @@ be self documenting.</p>
|
||||
<h2>Test program</h2>
|
||||
<p>The <a href="config_test.cpp">config_test.cpp</a> program can be used to
|
||||
verify which #defines are in effect for your compiler.</p>
|
||||
<p>The <a href="limits_test.cpp">limits_test.cpp</a> program can also be helpful
|
||||
in diagnosing configuration problems.</p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->10 Nov 2000<!--webbot bot="Timestamp" endspan i-checksum="15233" --></p>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->22 May 2001<!--webbot bot="Timestamp" endspan i-checksum="15106" --></p>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
158
limits_test.cpp
Normal file
158
limits_test.cpp
Normal file
@@ -0,0 +1,158 @@
|
||||
/* boost limits_test.cpp test your <limits> file for important
|
||||
*
|
||||
* Copyright Jens Maurer 2000
|
||||
* Permission to use, copy, modify, sell, and distribute this software
|
||||
* is hereby granted without fee 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$
|
||||
*/
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <iostream>
|
||||
|
||||
/*
|
||||
* General portability note:
|
||||
* MSVC mis-compiles explicit function template instantiations.
|
||||
* For example, f<A>() and f<B>() are both compiled to call f<A>().
|
||||
* BCC is unable to implicitly convert a "const char *" to a std::string
|
||||
* when using explicit function template instantiations.
|
||||
*
|
||||
* Therefore, avoid explicit function template instantiations.
|
||||
*/
|
||||
|
||||
template<class T>
|
||||
void test_integral_limits(const T &, const char * msg)
|
||||
{
|
||||
typedef std::numeric_limits<T> lim;
|
||||
std::cout << "Testing " << msg
|
||||
<< " (size " << sizeof(T) << ")"
|
||||
<< " min: " << lim::min() << ", max: " << lim::max()
|
||||
<< std::endl;
|
||||
|
||||
BOOST_TEST(lim::is_specialized);
|
||||
BOOST_TEST(lim::is_integer);
|
||||
// BOOST_TEST(lim::is_modulo);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void print_hex_val(T t, const char* name)
|
||||
{
|
||||
const unsigned char* p = (const unsigned char*)&t;
|
||||
std::cout << "hex value of " << name << " is: ";
|
||||
for (unsigned int i = 0; i < sizeof(T); ++i) {
|
||||
if(p[i] <= 0xF)
|
||||
std::cout << "0";
|
||||
std::cout << std::hex << (int)p[i];
|
||||
}
|
||||
std::cout << std::dec << std::endl;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void test_float_limits(const T &, const char * msg)
|
||||
{
|
||||
std::cout << "\nTesting " << msg << std::endl;
|
||||
typedef std::numeric_limits<T> lim;
|
||||
|
||||
BOOST_TEST(lim::is_specialized);
|
||||
BOOST_TEST(!lim::is_modulo);
|
||||
BOOST_TEST(!lim::is_integer);
|
||||
BOOST_TEST(lim::is_signed);
|
||||
|
||||
const T infinity = lim::infinity();
|
||||
const T qnan = lim::quiet_NaN();
|
||||
const T snan = lim::signaling_NaN();
|
||||
|
||||
std::cout << "IEEE-compatible: " << lim::is_iec559
|
||||
<< ", traps: " << lim::traps
|
||||
<< ", bounded: " << lim::is_bounded
|
||||
<< ", exact: " << lim::is_exact << '\n'
|
||||
<< "min: " << lim::min() << ", max: " << lim::max() << '\n'
|
||||
<< "infinity: " << infinity << ", QNaN: " << qnan << '\n';
|
||||
print_hex_val(lim::max(), "max");
|
||||
print_hex_val(infinity, "infinity");
|
||||
print_hex_val(qnan, "qnan");
|
||||
print_hex_val(snan, "snan");
|
||||
|
||||
BOOST_TEST(lim::max() > 1000);
|
||||
BOOST_TEST(lim::min() > 0);
|
||||
BOOST_TEST(lim::min() < 0.001);
|
||||
BOOST_TEST(lim::epsilon() > 0);
|
||||
|
||||
if(lim::is_iec559) {
|
||||
BOOST_TEST(lim::has_infinity);
|
||||
BOOST_TEST(lim::has_quiet_NaN);
|
||||
BOOST_TEST(lim::has_signaling_NaN);
|
||||
} else {
|
||||
std::cout << "Does not claim IEEE conformance" << std::endl;
|
||||
}
|
||||
|
||||
if(lim::has_infinity) {
|
||||
// make sure those values are not 0 or similar nonsense
|
||||
// infinity is beyond the representable range
|
||||
BOOST_TEST(infinity > lim::max());
|
||||
BOOST_TEST(-infinity < -lim::max());
|
||||
} else {
|
||||
std::cout << "Does not have infinity" << std::endl;
|
||||
}
|
||||
|
||||
if(lim::has_quiet_NaN) {
|
||||
// NaNs shall always compare "false" when compared for equality
|
||||
// If one of these fail, your compiler may be optimizing incorrectly
|
||||
BOOST_TEST(! (qnan == 42));
|
||||
BOOST_TEST(! (qnan == qnan));
|
||||
BOOST_TEST(qnan != 42);
|
||||
BOOST_TEST(qnan != qnan);
|
||||
|
||||
// The following tests may cause arithmetic traps etc. Avoid for now.
|
||||
// BOOST_TEST(! (qnan < 42));
|
||||
// BOOST_TEST(! (qnan > 42));
|
||||
// BOOST_TEST(! (qnan <= 42));
|
||||
// BOOST_TEST(! (qnan >= 42));
|
||||
} else {
|
||||
std::cout << "Does not have QNaN" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
{
|
||||
test_integral_limits(bool(), "bool");
|
||||
test_integral_limits(char(), "char");
|
||||
typedef signed char signed_char;
|
||||
test_integral_limits(signed_char(), "signed char");
|
||||
typedef unsigned char unsigned_char;
|
||||
test_integral_limits(unsigned_char(), "unsigned char");
|
||||
test_integral_limits(wchar_t(), "wchar_t");
|
||||
test_integral_limits(short(), "short");
|
||||
typedef unsigned short unsigned_short;
|
||||
test_integral_limits(unsigned_short(), "unsigned short");
|
||||
test_integral_limits(int(), "int");
|
||||
typedef unsigned int unsigned_int;
|
||||
test_integral_limits(unsigned_int(), "unsigned int");
|
||||
test_integral_limits(long(), "long");
|
||||
typedef unsigned long unsigned_long;
|
||||
test_integral_limits(unsigned_long(), "unsigned long");
|
||||
#if defined(__GNUC__) && !(__GNUC__ == 3 && __GNUC_MINOR__ == 0 && defined(__GLIBCPP__))
|
||||
typedef long long long_long;
|
||||
test_integral_limits(long_long(), "long long");
|
||||
typedef unsigned long long unsigned_long_long;
|
||||
test_integral_limits(unsigned_long_long(), "unsigned long long");
|
||||
#endif
|
||||
|
||||
test_float_limits(float(), "float");
|
||||
test_float_limits(double(), "double");
|
||||
typedef long double long_double;
|
||||
test_float_limits(long_double(), "long double");
|
||||
// Some compilers don't pay attention to std:3.6.1/5 and issue a
|
||||
// warning here if "return 0;" is omitted.
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user