Boost logo

Boost Users :

Subject: Re: [Boost-users] Describing "traits" of a class's members
From: Chris Stankevitz (chrisstankevitz_at_[hidden])
Date: 2013-02-27 19:49:47


On Wed, Feb 27, 2013 at 4:08 PM, Chris Stankevitz
<chrisstankevitz_at_[hidden]> wrote:
> Can you modify the attached program so that the object
> TCPositionTraits holds all the traits for the TCPosition object. Not
> just the traits for the "double" parameters, as is currently the case.
> Notably missing from TCPositionTraits is a reference to
> TCPosition::mSteps.

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.

The basic idea is to make TCPositionTraits::TSItem an abstract base
class, then create implementations that handle the various types of
position parameters.

Chris




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