Go to the SVN repository for this file.
1 #ifndef NCBI_LIMITS__HPP 2 #define NCBI_LIMITS__HPP 78 #if defined(HAVE_LIMITS) && ( !defined(NCBI_COMPILER_WORKSHOP) || NCBI_COMPILER_VERSION >= 550) 92 # define numeric_limits ncbi_numeric_limits 101 # define NCBI_NUMERIC_LIMITS(type, alias) \ 103 class numeric_limits<type> \ 106 static inline type min() THROWS_NONE { return kMin_##alias; } \ 107 static inline type max() THROWS_NONE { return kMax_##alias; } \ 110 # define NCBI_NUMERIC_LIMITS_UNSIGNED(type, alias) \ 112 class numeric_limits<type> \ 115 static inline type min() THROWS_NONE { return 0; } \ 116 static inline type max() THROWS_NONE { return kMax_##alias; } \ 129 #if defined(HAVE_WCHAR_H) && defined(WCHAR_MIN) 145 # if (SIZEOF_LONG_LONG > 0) 150 # if defined(NCBI_INT8_IS_INT64) 164template <typename T, bool is_signed = numeric_limits<T>::is_signed>
174 #if defined(NCBI_HAVE_CXX11) && !defined(NCBI_COMPILER_ICC) 177 returnTStdLim::lowest();
184 template<
typenameT>
189 static T min(
void) {
return0; }
194 template<
typenameT>
204 template<
typenameT>
215 # define NCBI_FORBID_AUTOMINMAX_OPERATION(op, T1, T2) \ 216 template <typename T> \ 217 inline bool operator op(const T1&, const T2&) { \ 218 typename T::T1##T2##OperationNotSupported tmp; \ 222 # define NCBI_FORBID_AUTOMINMAX_OPERATIONS(op) \ 223 NCBI_FORBID_AUTOMINMAX_OPERATION(op, SAutoMax, T) \ 224 NCBI_FORBID_AUTOMINMAX_OPERATION(op, SAutoMin, T) \ 225 NCBI_FORBID_AUTOMINMAX_OPERATION(op, T, SAutoMax) \ 226 NCBI_FORBID_AUTOMINMAX_OPERATION(op, T, SAutoMin) 245template<typename
T>
248 typenameT::TypeIsNotSupported
tmp;
249 returnnumeric_limits<T>();
253 # define NCBI_GET_NUMERIC_LIMITS(type) \ 255 inline numeric_limits<type> get_limits(const type&) \ 256 { return numeric_limits<type>(); } 274 # if (SIZEOF_LONG_LONG > 0) 279 # if defined(NCBI_INT8_IS_INT64)#define NCBI_NUMERIC_LIMITS(type, alias)
Auxiliary macro to implement (a limited edition of) the "numeric_limits<>" template.
static const SAutoMin kMin_Auto
Generic stand-in for type-specific kMin_* constants from ncbi_limits.h, useful in any context with ex...
ncbi_numeric_limits< T > TStdLim
#define numeric_limits
Pre-declaration of the "numeric_limits<>" template Forcibly overrides (using preprocessor) the origin...
#define NCBI_NUMERIC_LIMITS_UNSIGNED(type, alias)
#define NCBI_GET_NUMERIC_LIMITS(type)
Macro to declare specialized get_limits.
char Char
Alias for char.
static const SAutoMax kMax_Auto
Generic stand-in for type-specific kMax_* constants from ncbi_limits.h, useful in any context with ex...
ncbi_numeric_limits< T > TStdLim
#define NCBI_FORBID_AUTOMINMAX_OPERATIONS(op)
static T min(void)
For non-integral types, yield a huge negative value rather than a tiny positive one.
ncbi_numeric_limits< T > get_limits(const T &)
Generic template to get STD limits by a variable.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
The NCBI C++/STL use hints.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4