
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/03/2010 09:22 PM, Scott McMurray wrote:
Would your average developer know about that sort of thing? I've been using C++ since 1987, and I'd never seen it until a couple months ago. And then only by digging into the Boost.TypeTraits library's source code to figure out how it worked.
Does "your average developer" even write templates that use the extra power than templates offer over generics?
Not sure what you mean, since in C++ "generics" means templates to me. And I don't know how I stack up to the average developer, but I've been writing template code for years and never knew about that.
I'm not convinced that Boost should be all that concerned about developers attempting to write generic code while ignorant of fundamental template building blocks. The trick behind enable_if has been known by the acronym SFINAE since at least 2002, thanks to Vandevoorde and Josuttis's book [1]. AlexanÂdresÂcu's _Modern C++ Design_ [2] -- containing templates far more complicated than a simple specialization -- was published more than 20 months earlier than that. These are not bleeding-edge or secret techniques.
Ah, that explains it -- most programmers don't buy or read books since the Internet became widely available. I do, but I only go looking for one when I run into a problem, which is likely why I missed those two... I've never run into a problem that only they would have a solution for.
That said, I'm not sure whether it's better to not provide min and max, and thus catch code that uses them without checking is_bounded, or to possibly make it easier to correctly write code that does check is_bounded.
I figured that compiler writers probably knew more about it than I did, and followed their example.
And who knows -- maybe making it easy with SFINAE would mean that those developers that don't know will go looking for the clean way and learn a new tool.
Stranger things have happened. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvfe6QACgkQp9x9jeZ9/wRCCQCeLM0JPubKh9DMWPAutCLiHIZe toMAoOxS4jIcIOQeyINhGc6knKEx8aNx =6CL8 -----END PGP SIGNATURE-----