Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-04-03 08:58:49


on 4/2/01 8:52 AM, nbecker_at_[hidden] wrote:

>>> Here is my submission. Please let me know what you think.
> ...
>> You don't have to pass the Assign policy as a template parameter, it can be
>> passed in as a type parameter ("Wrap<width>" instead of "Wrap"). This allows
>> non-template classes be used as policies
>
> Thank you for the comments. I'm not sure what this one means. Do you
> mean
>
> Sint::Int<4, Wrap<4> > x ?

Yes.

> This violates the principle that information should be specified exactly once.

But it restricts the second argument to be a template class with exactly one
template argument. The other way keeps common variations open. The system
I suggest is what the I/O stream stuff uses. The character type is a
type-based template parameter, the traits type is another type-based
template parameter (defaulted to std::char_traits<CharType>). A way to trim
the arguments down would be to completely depend on the policy argument, and
use a class-static constant from it to define the bit width (Policy::width).

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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