|
Boost : |
Subject: Re: [boost] [xint] Third release is ready, requesting preliminary review
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-05-03 21:22:35
On 3 May 2010 20:54, Chad Nelson <chad.thecomfychair_at_[hidden]> 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?
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.
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.
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.
[1] http://en.wikipedia.org/wiki/SFINAE
[2] http://erdani.com/book/main.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk