Re: How to elegantly get the enum code from its string type
On Apr 13, 4:56 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
"Keith H Duggar" <dug...@alum.mit.edu> wrote in
messagenews:e86bc9d5-0014-4401-840b-292ee28cda1c@y21g2000vbf.googlegroups.com...
It isn't "divine". It is observed from experience and/or
derived from sometimes quite detailed debates. The problem
is you simply refuse to educate yourself on those technical
debates nor to accept the limitations of your experience.
Consider this:
1) std::vector<T>::operator[](size_type) is widely used (in practice not
theory)
2) std::vector<T>::size_type is a typedef of std::allocator<T>::size_type
3) std::allocator<T>::size_type is a typedef of std::size_t
4) std::size_t is an unsigned integral type
ergo
unsigned integral types are widely used in practice (not theory).
Ergo: the person who designed the STL didn't really understand
unsigned types in C++. (Regretfully true.)
In general: mixing signed and unsigned should be avoided (since
it's broken in C++). So having to compare with e.g.
std::vector<>::size() is a compelling reason for using an
unsigned type.
I don't attach much value to the debates that occur in this
newsgroup primarily because it is not moderated and the
debates themselves are more often than not simply pissing
contests. :)
You'll find the same arguments (and the same conclusions) in the
moderated groups. Or elsewhere. (Stroustrup uses plain int
almost everywhere; he was, I believe, strongly influenced by
Kernighan and Richie in this, having worked under Kernighan for
many years.)
--
James Kanze