Boost logo

Boost :

From: Emily Winch (emily_at_[hidden])
Date: 2001-11-26 09:33:26


> > I'm not convinced that this looks sensible though:
> >
> > whatever< smaller<T>, bigger<U> >::value
> >
> > rather than
> >
> > is_bigger< T, U >::value
>
> Why not?
 
The first has redundant information which only serves to make the expression
longer and more complex, at the expense of readability (for me, at any
rate). I think it's nice that template "functions" (not function templates!)
have a very similar syntax to normal functions, and it would be a shame to
break that.

For consistency you would also really have to make is_pointer (and friends)
also work like this

whatever< is_pointer< T > >::value

which could be confusing.

> > I thought of a practical use of a two-parameter type predicate passed as
a
> > template template parameter. If you sort a tuple by the size of the
> objects
> > so the biggest ones go first, you might make it smaller (less padding
> > required). Clearly this would be neatly achieved by passing is_bigger as
a
> > predicate to a sorting algorithm.
>
> Yes, believe it or not I used a compile-time insertion sort with a binary
> predicate in my last job!
 

_I_ want a job like that!

Emily


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk