Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 1999-12-03 18:55:19


Not sure if this is exactly what you're looking for, but I'm currently
using this in my work:

template <typename Size, Size sz>
struct number
{
        operator Size() const {return sz;}
};

I'm using it as the default argument for a template parameter. The
client template sometimes needs a type like size_t that can take on
different values, and other times the client just needs a constant. The
struct number is good for those times only a constant is needed because
it is zero-sized.

You'll have to tell me whether this little animal solves your problem or
not.

-Howard

jsiek_at_[hidden] wrote on 12/3/99 6:45 PM
>Just wondering if anyone has thought of doing a traits class
>for getting the appropriate value for zero and one given
>some number type.
>
>Cheers,
>
>Jeremy
>
>------------------------------------------------------------------------
>et the most popular downloads on the Web. They¼re new!
>They¼re hot! Theyíre FREE! Utilities, drivers, games.
>Itís all here. http://clickhere.egroups.com/click/1610
>
>
>
>eGroups.com Home: http://www.egroups.com/group/boost/
>http://www.egroups.com - Simplifying group communications
>
>


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