I'd like to know why std::numeric_limits<>::max (and some, but not all other
values in numeric_limits) was chosen to be a function instead of just being
a constant. I would have needed it in a template argument, but can't use it
there, because it's not a constant expression.
Dear Sir I have a question in atl.html the latest post I made, please
come answer, I need to learn the basic steps in that, I don't need
real life big hard software from corporation for me to join in some
team to create.
I think I begin to fall for web now and possibly long later in the
future.
About your question,
there is probably a '_max' variable that might have been implemented
as a private object for easier, safer and more efficient manipulation
later in the client code, so max is named to be used as a function. Do
you agree to that ?
You should post to 'comp.std.c++' then. There decisions and the
rationales behind the Standard and any of its parts are discussed. Some
folks *here* might remember how those things (functions) came to be
functions, of course, but 'c.s.c++' is more reliable.
> I would have needed it in a template argument, but can't use it
> there, because it's not a constant expression.
You may need to redesign your classes to accommodate functions there.
If you post your code and describe what you're trying to accomplish,
perhaps somebody could make a suggestion...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
I believe it was because the floating point values could not be const
static members initialized in the class definition. So it was
considered more consistent to make them all functions. That way, at
least they could be inlined.
>
>> I would have needed it in a template argument, but can't use it
>> there, because it's not a constant expression.
It doesn't help you here, but in C++0x the members of numeric_limits
will be declared constexpr, to make them usable as constant
expressions, even though they remain functions. A new language
feature!
Bo Persson
> > You should post to 'comp.std.c++' then. There decisions and
> > the rationales behind the Standard and any of its parts are
> > discussed. Some folks *here* might remember how those
> > things (functions) came to be functions, of course, but
> > 'c.s.c++' is more reliable.
> I believe it was because the floating point values could not
> be const static members initialized in the class definition.
> So it was considered more consistent to make them all
> functions.
They have to all be functions, or none, or you can't very easily
use the value in a template.
--
James Kanze
Rolf Magnus wrote:
Compile your code as C++0x period.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAktAniIACgkQG6NzcAXitM8XBQCfTyYM4vn+1QqADazIwSPzhXjv
Ls4AnRIbzljlPu4bQOmBMrBwdIY+Bjf7
=cMaJ
-----END PGP SIGNATURE-----