From: Joel de Guzman (joel_at_[hidden])
Date: 2003-10-24 00:31:17
Brian McNamara <lorgon_at_[hidden]> wrote:
> On Fri, Oct 24, 2003 at 09:25:54AM +0800, Joel de Guzman wrote:
>> Well, I was kinda hoping that you have a trick up your sleeve :->
>> If you can think of something better, I'm all ears.
> Perhaps I am stuck in a mental rut, but it's hard for me to imagine
> anything better than the enable_if solution for something like this.
> After all:
> - you want to write a template function which only works on arguments
> that meet some certain criteria
> and, lo,
> - enable_if ensures that the function only 'exists' for arguments that
> meet criteria specified by a value/metafunction, and
> - writing the (is_XXX) metafunction to define the criteria is
> So, I'm not sure why this solution would seem unsatisfying, or why you'd
> be looking for something "better". (Or maybe I'm putting words in your
> mouth by suggesting you find it dissatisfying.)
No, it's not dissatisfying at all. I like enable_if.
> What qualities would a "better" solution have? More concise to write?
> Faster compile-time? Something else? Maybe I do have the right trick
> somewhere in my bag-o-tricks, but I'm not sure what I'm looking for. :)
Perhaps, "something better" in my book, would mean something that
works on more compilers, even those that do not have SFINAE. FWIW,
CRTP works on more compilers. Whether I like it or not, I still have to
support VC6 and Borland.
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk