comparison DEPENDENCIES/generic/include/boost/functional/hash/detail/limits.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1
2 // Copyright 2005-2009 Daniel James.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 //
6 // On some platforms std::limits gives incorrect values for long double.
7 // This tries to work around them.
8
9 #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
10 #define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
11
12 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
13 # pragma once
14 #endif
15
16 #include <boost/limits.hpp>
17
18 // On OpenBSD, numeric_limits is not reliable for long doubles, but
19 // the macros defined in <float.h> are and support long double when STLport
20 // doesn't.
21
22 #if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
23 #include <float.h>
24 #endif
25
26 namespace boost
27 {
28 namespace hash_detail
29 {
30 template <class T>
31 struct limits : std::numeric_limits<T> {};
32
33 #if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
34 template <>
35 struct limits<long double>
36 : std::numeric_limits<long double>
37 {
38 static long double epsilon() {
39 return LDBL_EPSILON;
40 }
41
42 static long double (max)() {
43 return LDBL_MAX;
44 }
45
46 static long double (min)() {
47 return LDBL_MIN;
48 }
49
50 BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
51 BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
52 BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
53 #if defined(_STLP_NO_LONG_DOUBLE)
54 BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);
55 #endif
56 };
57 #endif // __OpenBSD__
58 }
59 }
60
61 #endif