Topic: Any chance to standardize static_min, static_max?
Author: "Andrei Alexandrescu" <andrewalex@hotmail.com>
Date: 14 Jun 01 01:54:25 GMT Raw View
There are a couple of vestiges from <limits.h> that I must use: INT_MIN,
INT_MAX, and the such.
I could use std::numeric_traits<int>::min() and max, but they are functions
not static values, so their usage is limited in generic code.
Is there a chance that the standard adds four more fields?
template <class T>
struct numeric_traits
{
...
static const bool has_static_limits;
static const T static_min;
static const T static_max;
};
If a type does not support static values for min and max, has_static_limits
is false, and static_min and static_max are not defined. I understand this
is the case for certain floating point implementations - could anyone, um,
_expand :o) on that?
That would be enough support for getting rid of those INT_MIN et al. macros.
Any chance to see static minimum and maximum values in C0x?
Andrei
--
Check out THE C++ Seminar: 3 Days with 5 Experts
http://www.gotw.ca/cpp_seminar
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]