|
Boost Users : |
Subject: Re: [Boost-users] Describing "traits" of a class's members
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-02-27 20:55:52
AMDG
On 02/27/2013 05:32 PM, Chris Stankevitz wrote:
> On Wed, Feb 27, 2013 at 4:49 PM, Chris Stankevitz
> <chrisstankevitz_at_[hidden]> wrote:
>> Attached is an example of how do do this. Drawback: the
>> TCPositionTraits object now has a lot of typing in it. And if/when
>> you create another object (e.g. TCEmployeeTraits) you are going to
>> have to do a lot of typing again. There will be a lot of code
>> duplication.
>
> Attached is a version that eliminates the code duplication. Drawback:
> it's now a mess of templates and specializations.
>
One more thing that would make this look
a bit better:
... mItems = {
makeItem(&TCPosition::mLatitude, TCPosition::sLatitudeTraits),
...
};
makeItem is a pretty simple function template.
In Christ,
Steven Watanabe
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