|
Boost Users : |
Subject: Re: [Boost-users] Using different variables based on template type
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-06-02 23:54:41
2009/6/2 Ryan McConnehey <mccorywork_at_[hidden]>:
> Scott McMurray wrote:
>>
>> They're at least simple, but it's still a violation of DRY,
>> so I'm not a big fan.
>>
>
> If a non-expanding interface is needed (non-template so that every type
> isn't accepted) does it really violate DRY?
>
Sure. Just 'cause it's templated doesn't mean it'll accept anything.
In the inheriting version, for example, the delegating to a
type-specific base class keeps it from accepting "anything".
>> What are the types really, anyways?
>
> I've create true_typedef of the basic type like uint16, uint32, int16, etc.
> Â I've written my own serialization interface (I know boost already has one)
> and I'm restricting the interface to only allow certain types. Â I'm trying
> to centralize the were the real work happens so if new types are needed then
> added them won't be difficult.
>
So you want a way where you have an MPL typelist of the types, and
just adding a type to that typelist is all you need to do. (Or to a
PP sequence, or ...)
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net